Regarding Thread pooling

S

sujata

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.
 
A

Aahz

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?

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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top