Package papyros :: Module singlethreaded
[hide private]
[frames] | no frames]

Source Code for Module papyros.singlethreaded

 1  '''A non-concurrent implementation of the papyros master-slave API. 
 2   
 3  This is mainly for the sake of completeness and perhaps as a fallback in systems 
 4  that the concurrent implementations are not available. 
 5  ''' 
 6   
 7  __all__ = ['SingleThreadedMaster'] 
 8   
 9  from papyros import Master, Slave 
10   
11 -class SingleThreadedMaster(Master,Slave):
12
13 - def __init__(self, poll_time=1, request_qsize=0, response_qsize=0):
14 Master.__init__(self, request_qsize, response_qsize) 15 Slave.__init__(self, self, poll_time)
16
17 - def popProcessedJob(self, timeout=None):
18 if timeout > 0: 19 raise ValueError('Cannot guarantee non-zero timeout in single-threaded mode') 20 if timeout is None: 21 self.process() 22 return Master.popProcessedJob(self,timeout)
23