equal
deleted
inserted
replaced
6 # Copyright (C) 2018: Edouard TISSERANT |
6 # Copyright (C) 2018: Edouard TISSERANT |
7 # |
7 # |
8 # See COPYING.Runtime file for copyrights details. |
8 # See COPYING.Runtime file for copyrights details. |
9 |
9 |
10 from __future__ import absolute_import |
10 from __future__ import absolute_import |
|
11 import sys |
11 import thread |
12 import thread |
12 from threading import Lock, Condition |
13 from threading import Lock, Condition |
13 |
14 |
14 class job(object): |
15 class job(object): |
15 """ |
16 """ |
52 """ |
53 """ |
53 meant to be called by worker thread (blocking) |
54 meant to be called by worker thread (blocking) |
54 """ |
55 """ |
55 self._threadID = thread.get_ident() |
56 self._threadID = thread.get_ident() |
56 if args or kwargs: |
57 if args or kwargs: |
57 job(*args, **kwargs).do() |
58 _job = job(*args, **kwargs) |
58 # result is ignored |
59 _job.do() |
|
60 if _job.success: |
|
61 # result is ignored |
|
62 pass |
|
63 else: |
|
64 raise _job.exc_info[0], _job.exc_info[1], _job.exc_info[2] |
59 self.mutex.acquire() |
65 self.mutex.acquire() |
60 while not self._finish: |
66 while not self._finish: |
61 self.todo.wait() |
67 self.todo.wait() |
62 if self.job is not None: |
68 if self.job is not None: |
63 self.job.do() |
69 self.job.do() |