[Python-ideas] @run_as_thread decorator

Giampaolo Rodolà g.rodola at gmail.com
Sat Mar 5 14:21:32 CET 2011


 >>> import time, threading
 >>>
 >>> @threading.run_as_thread
 ... def foo():
 ...     time.sleep(100)
 ...     return 1
 ...
 >>> t = foo()
 >>> t.isAlive()
 True
 >>> t.join()
 >>> t.isAlive()
 False
 >>>

The same thing could be done for multiprocessing module.
Would this be acceptable for inclusion?


--- Giampaolo
http://code.google.com/p/pyftpdlib/
http://code.google.com/p/psutil/



More information about the Python-ideas mailing list