C#. How to terminate a thread which has spawned another thread which is sleeping?

Posted by Bobb on Stack Overflow See other posts from Stack Overflow or by Bobb
Published on 2010-06-13T19:32:21Z Indexed on 2010/06/13 19:42 UTC
Read the original article Hit count: 243

Filed under:
|
|

I have a long running thread made from Thread.Start(). It spawns a background thread using QueueUserWorkItem which sleeps most of the time.

Then the class-owner get disposed I call thread1.Join() but naturally it doesnt return because its child background thread is sleeping.

What would be the right solution to gracefully terminate a thread which has other threads with little hassle?

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about threads