Threadpool and application resource cleanup 
Author Message
 Threadpool and application resource cleanup

Hi

My application is using threadpools. so far successful.
Inside a main worker thread , I post work items to the pool queue.

What I want to know is, If I had to cancel my work and shut down my
application,
while there are pending work in the queue, how will it effect to the system?

I know, you can't cancel workitems in the queue.. so how do we do a proper
cleanup ? because the queued workitems may want some resources
in my app, so if i just shut it down, god knows how it will behave.

So far what I do is,

when posting queue items Increment a counter.

When the job from threadpool is done decrement using

Interlocked.Decriment(ref workItems)

and in my cleanup routine , I wait til workItems get to 0.
but the problem is if I do not get back to Service Control Manager within a
reasonable
amount of time, it will say that my service didn't respond, even though I am
trying to close
down gracefully.

Any solutions?

Regards
KK



Sat, 23 Oct 2004 05:57:13 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. cleanup and release resources

2. Cleanup of Visual C's Resource Toolbar

3. ThreadPool possible bug? [NUnit test included]

4. ThreadPool and workers

5. ThreadPool yes or no

6. What to do when ThreadPool.GetAvailableThreads==0?

7. Controls & threadpool

8. ThreadPool help

9. question about threadPool

10. ThreadPool Class.

11. limiting workitems in the threadpool ?

12. Problems with threadpool/ISAPI/MFC!

 

 
Powered by phpBB® Forum Software