Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class GarageDoorMonitor(NonBlockingMonitor, Garage):
- _doOpen = None
- _doClose = None
- def __init__(self, openMethod, closeMethod):
- """Create a new monitor to manage concurrent access to the door.
- Params:
- openMethod the method to call to actually open the door.
- You may need to time.sleep() there.
- closeMethod the method to call to actually close the door.
- You may need to time.sleep() there.
- """
- NonBlockingMonitor.__init__(self)
- Garage.__init__(self)
- self._doOpen = openMethod
- self._doClose = closeMethod
- def open(self):
- return self.do(self._doOpen)
- def close(self):
- return self.do(self._doClose)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement