S.Mohideen <[EMAIL PROTECTED]> wrote: > Hi All, > > Can you please suggest a technique in Python where we can spawn few number > of worker threads and later map them to a function/s to execute individual > Jobs. > > Any references would be helpful..
I believe I give some examples in the Nutshell, but the basic idea is very simple: start the N worker threads you want in your pool -- they all use .get on the same Queue.Queue instance qI which contains "work requests" (WRs). A WR could e.g. be a tuple with a Queue qO (or None to indicate that the result is not interesting), a callable, and 0+ arguments (or an empty tuple to request thread termination); the worker thread just calls the callable on the arguments and puts the result to qO (if qO is not None). Many other similar arrangements are possible, depending on your application's exact needs, but I hope the general idea is clear. Alex -- http://mail.python.org/mailman/listinfo/python-list