MCPcopy Create free account
hub / github.com/ActiveState/code / addCmd

Method addCmd

recipes/Python/577505_Command_Threads/recipe-577505.py:56–70  ·  view source on GitHub ↗

non-blocking call.

(self, callableObj, *args, **argd)

Source from the content-addressed store, hash-verified

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.

Callers 1

demoFunction · 0.95

Calls 5

partialFunction · 0.85
callableFunction · 0.50
acquireMethod · 0.45
releaseMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected