runtime/Worker.py
changeset 2467 fce6ab7ae156
parent 2463 8742337a9fe3
child 2486 44c2a4e2b84d
equal deleted inserted replaced
2466:98d28d809488 2467:fce6ab7ae156
    54     def runloop(self, *args, **kwargs):
    54     def runloop(self, *args, **kwargs):
    55         """
    55         """
    56         meant to be called by worker thread (blocking)
    56         meant to be called by worker thread (blocking)
    57         """
    57         """
    58         self._threadID = thread.get_ident()
    58         self._threadID = thread.get_ident()
       
    59         self.mutex.acquire()
    59         if args or kwargs:
    60         if args or kwargs:
    60             _job = job(*args, **kwargs)
    61             _job = job(*args, **kwargs)
    61             _job.do()
    62             _job.do()
    62             if _job.success:
    63             if _job.success:
    63                 # result is ignored
    64                 # result is ignored
    64                 pass
    65                 pass
    65             else:
    66             else:
    66                 raise _job.exc_info[0], _job.exc_info[1], _job.exc_info[2]
    67                 raise _job.exc_info[0], _job.exc_info[1], _job.exc_info[2]
    67         self.mutex.acquire()
       
    68         while not self._finish:
    68         while not self._finish:
    69             self.todo.wait()
    69             self.todo.wait()
    70             if self.job is not None:
    70             if self.job is not None:
    71                 self.job.do()
    71                 self.job.do()
    72                 self.done.notify()
    72                 self.done.notify()