Re: How to control threads
Tuesday, December 11, 2001 06:45 AM
create a pool of thread workers that are serving your clients. when requests start to come in, try to get a worker thread from the pool. if there are any available threads, give it the request and let it fulfill it. if there are no threads available, block the incoming thread and wait until one becomes available. by managing your thread pool of workers you can later increase/decrease the size of the pool, and do many other nice things. there are thread pool stuff out there on the web so if you do a search I am sure you will be able to find the implementation that you can reuse.