Skip to content

Commit 1bdae40

Browse files
committed
allow stop from a registered service
1 parent 6dd1b40 commit 1bdae40

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

mercury/platform.py

+7
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,13 @@ def connect_to_cloud(self):
558558
self._loop.run_in_executor(self._executor, self._cloud.start_connection)
559559

560560
def stop(self):
561+
#
562+
# to allow user application to invoke the "stop" method from a registered service,
563+
# the system must start a new thread so that the service can finish first.
564+
#
565+
threading.Thread(target=self._bye).start()
566+
567+
def _bye(self):
561568
if not self.stopped:
562569
# guarantee this stop function to execute only once
563570
self.stopped = True

0 commit comments

Comments
 (0)