def stop_synapse(self):
        if self.resourcefile:
            self.resourcefile.done = True


        # Close the controller and wait for it to quit
        if self.controller:
            if self.controller.isAlive():
                self.controller.close()
                self.controller.join()
                self.logger.debug("Controller thread stopped")

        self.logger.info("Successfully stopped.")
Closes all threads and exits properly.
dataset/ETHPy150Open comodit/synapse-agent/synapse/dispatcher.py/Dispatcher.stop_synapse