示例#1
0
文件: base.py 项目: clofresh/passing
 def receive(self, timeout=None):
     ''' Synchronously wait `timeout` seconds for a message. If a message
         arrives by then, return it, otherwise, raise a `Timeout`.
     '''
     promise = get_pool().apply_async(self._receive)
     try:
         data = promise.get(timeout)
     except multiprocessing.TimeoutError:
         raise Timeout()
     else:
         return data
示例#2
0
文件: base.py 项目: clofresh/passing
 def send(self, recipient, message):
     ''' Asynchronously send `message` to `recipient`
     '''
     get_pool().apply_async(self._send, (recipient, message))