29 Mar
2012
29 Mar
'12
3:08 p.m.
On 2012-03-29, at 3:48 PM, Andrew Svetlov wrote:
I propose to add Thread.interrupt() function.
th.interrupt() will set a flag in ThreadState structure.
When interpreter switches to next thread it will check that flag. If flag is on then ThreadInterruptionError will be raised in thread context. If thread has blocked via threading locks (Lock, RLock, Condition, Semaphore etc) — exception is raised also.
+1. This feature would be nice for thread-pools. For instance to be able join a pool with a timeout. - Yury