def run(self): while not rospy.is_shutdown(): while not rospy.is_shutdown(): m = self.queue.get() if self.queue.empty(): break self.function(m)