[Python-ideas] pool threads

Jason Orendorff jason.orendorff at gmail.com
Wed Nov 10 05:37:23 CET 2010


2010/11/9 Kristján Valur Jónsson <kristjan at ccpgames.com>:
> 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.

multiprocessing.dummy provides a thread pool class. So another way to
implement queue_call would be:

    from multiprocessing.dummy import Pool
    _mypool = Pool()
    queue_call = _mypool.apply_async

-j



More information about the Python-ideas mailing list