Skip to content

Commit

Permalink
Add a shutdown signal
Browse files Browse the repository at this point in the history
Provide a way for code that is not a modRana module to cleanup on shutdown
without the need for modules to trigger the cleanup on shutdown.

It is now enough to just connect to the shutdown_signal provided by the modrana singleton. :)
  • Loading branch information
M4rtinK committed Nov 16, 2015
1 parent 67e5223 commit 3a5f47a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modrana.py
Expand Up @@ -128,7 +128,9 @@ def __init__(self):
'name': ""
}

# signals
self.notificationTriggered = Signal()
self.shutdown_signal = Signal()

self.mapRotationAngle = 0 # in radians
self.notMovingSpeed = 1 # in m/s
Expand Down Expand Up @@ -515,6 +517,8 @@ def shutdown(self):
log.info("Shutting-down modules")
for m in self.m.values():
m.shutdown()
# trigger the shudown signal
self.shutdown_signal()
self._saveOptions()
modrana_log.log_manager.disable_log_file()
log.info("Shutdown complete (%s)" % utils.get_elapsed_time_string(start_timestamp))
Expand Down

0 comments on commit 3a5f47a

Please sign in to comment.