How to know who kills my threads

Posted by mcabral on Stack Overflow See other posts from Stack Overflow or by mcabral
Published on 2010-04-20T14:26:47Z Indexed on 2010/04/20 14:33 UTC
Read the original article Hit count: 200

Filed under:
|
|

I got a thread that is just banishing.. i'd like to know who is killing my thread and why.

It occurs to me my thread is being killed by the OS, but i'd like to confirm this and if possible to know why it's killing it.

As for the thread, i can assert it has at least 40 min of execution before dying, but it suddenly dies around 5 min.

public void RunWorker()
{
    Thread worker = new Thread(delegate()
    {
        DoSomethingForALongLongTime();
    });

    worker.IsBackground = true;
    worker.SetApartmentState(System.Threading.ApartmentState.STA);
    worker.Start();
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about threads