August 2003
Beginner to intermediate
600 pages
12h 57m
English
The desktop version of the .NET Framework features a method called Thread.Join(). Given a thread called l_Thread, if another thread calls l_Thread.Join(), then the other thread blocks until l_Thread terminates. The .NET Compact Framework does not support Thread.Join().
One way to wait for another thread to die is to use a busy wait. For example, the thread method might update the Boolean class member m_Alive to false as it exits. Another thread can sit and wait for the first thread to finish by writing code that looks like this:
C#
// Wait for another thread to set m_Alive to false
while (m_Alive)
{
}
VB
' Wait for another thread to set m_Alive to false
while (m_Alive = True)
End While
This would be a very bad ...