|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Thread Detach NotificationHi,
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. 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 ----------------- Show quote "Majid" <me9***@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. > 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. Show quote "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" <me9***@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. > > > > > |
|||||||||||||||||||||||