Hi,

Is there a way in managed .NET to get a notification as to when a
thread exits normally? In the unmanaged world, you could handle the
DLL_THREAD_DETACH in DllMain( ), but I couldn't find anything in .NET
that gives you this notification. I could iterate through the list of
available threads in the process to find if a particular thread Id is
still alive, but that would not work for my implemenation. Thanks.

Re: Thread Detach Notification by Axel

Axel
Wed Feb 22 18:33:54 CST 2006

I'd try using a semaphore to signal when a thread ends. Or you might call a
function when your thread ends. (see Interlocked, lock{}, Mutex,
ThreadAbortException; all can be found in System.Threading)

HTH,
Axel Dahmen

-----------------
"Majid" <me9309@yahoo.com> schrieb im Newsbeitrag
news:1140566674.915992.263230@g44g2000cwa.googlegroups.com...
> Hi,
>
> Is there a way in managed .NET to get a notification as to when a
> thread exits normally? In the unmanaged world, you could handle the
> DLL_THREAD_DETACH in DllMain( ), but I couldn't find anything in .NET
> that gives you this notification. I could iterate through the list of
> available threads in the process to find if a particular thread Id is
> still alive, but that would not work for my implemenation. Thanks.
>



Re: Thread Detach Notification by Michael

Michael
Wed Feb 22 22:05:00 CST 2006

On the thread variable, you can use the join method.

dim MyThread as Thread
MyThread = new Thread(mythreadsub)
MyThread.Start

MyThread.Join ' Wait for MyThread to complete.

Mike.

"Axel Dahmen" <KeenToKnow@newsgroups.nospam> wrote in message
news:%23gZP3CBOGHA.812@TK2MSFTNGP10.phx.gbl...
> I'd try using a semaphore to signal when a thread ends. Or you might call
a
> function when your thread ends. (see Interlocked, lock{}, Mutex,
> ThreadAbortException; all can be found in System.Threading)
>
> HTH,
> Axel Dahmen
>
> -----------------
> "Majid" <me9309@yahoo.com> schrieb im Newsbeitrag
> news:1140566674.915992.263230@g44g2000cwa.googlegroups.com...
> > Hi,
> >
> > Is there a way in managed .NET to get a notification as to when a
> > thread exits normally? In the unmanaged world, you could handle the
> > DLL_THREAD_DETACH in DllMain( ), but I couldn't find anything in .NET
> > that gives you this notification. I could iterate through the list of
> > available threads in the process to find if a particular thread Id is
> > still alive, but that would not work for my implemenation. Thanks.
> >
>
>
>