[Python-ideas] pool threads
Kristján Valur Jónsson
kristjan at ccpgames.com
Wed Nov 10 03:52:00 CET 2010
Occasionally you want to do something on a worker thread from Python. Some operating systems, like Windows, maintain a threadpool for which you can queue a user work item to execute. I was thinking that it could be a good idea to expose such a functionality by the thread module.
With something like:
def thread.queue_call(callable, args, kwargs):
#invoke the OS threadpool api and have callable called
Then in threading.py:
From thread import queue_call
Def queue_call(callable, args, kwargs):
Thread(target=callable, args=args, kwargs=kwargs).start()
Having operating system support for this would free us from creating a new real thread every time such a pattern is invoked. It would also improve the latency of such a call since a thread creation isn't free.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas