Beispiel #1
0
 def shutdown(self):
     """Sends terminatory signals to the wrapped component, and shut down the componentWrapper.
     will warn if the shutdown took too long to confirm in action."""
     # TODO - what if the wrapped component has no control box?
     if self.alive: 
         self.put(Ipc.shutdown(),               "control") # legacy support.
         self.put(Ipc.producerFinished(),       "control") # some components only honour this one
         self.put(Ipc.shutdownMicroprocess(),   "control") # should be last, this is what we honour
     else:
         raise AttributeError("shutdown was previously called, or we were never activated.")
     self.inputComponent.isDead.wait(1)
     if not self.inputComponent.isDead.isSet(): # we timed out instead of someone else setting the flag
         warnings.warn("Timed out waiting on shutdown confirmation, may not be dead.")
     self.alive = False