ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Based in the code block you posted I can't spot the problem. But I tried a simple example which works fine for me (including the cleanup).

class MyPlugin(Plugin):

def __init__(self, context):
        super(MyPlugin, self).__init__(context)
        self._thread = threading.Thread(target=self.cb, args=())
        self._thread_running = True
        self._thread.start()

    def cb(self):
        while self._thread_running:
            print 'cb'
            time.sleep(0.1)
        print('thread finished')

    def shutdown_plugin(self):
        self._thread_running = False
        self._thread.join()