jobs 0 Junior Poster in Training

I need to create python script that is threaded. So the main program will run in infinite loop and just retrieving messages and putting them in a queue. (Main thread)

I need child threads from a pool to process the queue. When there is no stuff in the queue, they go to the pool and become available but they don't terminate. This has to be done continuously.

Main program need to keep putting stuff in the queue, when there are no messages, then it sleeps for short time and check back to see any messages.

To do this, I guess you don't write joinAll(), so that the main threads just don't wait for the child but goes to work.

am I right?

Also, child threads (a function that is threaded) will make connecitons to the database. I am planning to use threadpool, so that threads reuse the connections. So do you close the database connection at the end of the function? If not then the connection will be opened forever?