Regarding Thread pooling

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sujata

    Regarding Thread pooling

    Hi,
    I have a query regarding threads.
    Is it possible to create thread pools in python.i.e. create threads and then retrieve the memory allocated to it so that the same threads can be used over and over again rather than creating new threads each time i wish to execute functions many times. If its possible plz do let me know how to do so.
    Can one have control over memory this way?

    Thanking You.
    ----------------
    Regards,
    Sujata Y

  • Aahz

    #2
    Re: Regarding Thread pooling

    In article <mailman.105826 7003.16337.pyth on-list@python.org >,
    sujata <sujatay@cybage .com> wrote:[color=blue]
    >
    > I have a query regarding threads.
    >Is it possible to create thread pools in python.i.e. create threads and =
    >then retrieve the memory allocated to it so that the same threads can be =
    >used over and over again rather than creating new threads each time i =
    >wish to execute functions many times. If its possible plz do let me know =
    >how to do so.
    >Can one have control over memory this way?[/color]

    Certainly. What you need to do is set up a while loop in each thread
    that picks up work from a Queue. One of the work types contains a flag
    that tells the loop to exit. (There are other ways, but that's the
    simplest and most straightforward .)
    --
    Aahz (aahz@pythoncra ft.com) <*> http://www.pythoncraft.com/

    "Not everything in life has a clue in front of it...." --JMS

    Comment

    Working...