Executes function on creating thread and returns result.
(self, func, *args, **kwargs)
| 35 | self.__action = queue.Queue() |
| 36 | |
| 37 | def __call__(self, func, *args, **kwargs): |
| 38 | "Executes function on creating thread and returns result." |
| 39 | if _thread.get_ident() == self.__thread: |
| 40 | while not self.__action.empty(): |
| 41 | self.__action.get_nowait()() |
| 42 | return func(*args, **kwargs) |
| 43 | delegate = _Delegate(func, args, kwargs) |
| 44 | self.__action.put_nowait(delegate) |
| 45 | return delegate.value |
| 46 | |
| 47 | ################################################################################ |
| 48 |
nothing calls this directly
no test coverage detected