non-blocking call.
(self, callableObj, *args, **argd)
| 54 | |
| 55 | |
| 56 | def addCmd(self, callableObj, *args, **argd): |
| 57 | """ non-blocking call. |
| 58 | """ |
| 59 | assert(callable(callableObj)) |
| 60 | |
| 61 | self._condition.acquire() |
| 62 | if self._status == 'DONE': |
| 63 | self._condition.release() |
| 64 | return |
| 65 | |
| 66 | self._queue.put(partial(callableObj, *args, **argd)) |
| 67 | self._status = 'NORMAL' |
| 68 | |
| 69 | self._condition.notifyAll() |
| 70 | self._condition.release() |
| 71 | |
| 72 | def close(self, timeout=None): |
| 73 | """ blocking call, return after close/cancel is done. |