void WaitInternal()
{
Print("Wait() on thread {0}", m_currentThread);
if (m_currentThread.m_continuation.Store(0) == 0)
{
#if MT_TIMING
m_stopWatch.Stop();
m_currentThread.m_ticks += m_stopWatch.ElapsedTicks;
#endif
m_currentThread.m_state = MicroThreadState.Waiting;
RemoveCurrentThread();
m_waitingThreadCount++;
ScheduleNext();
}
else
{
//Print("Wait() ended on thread {0}", m_currentThread);
if (m_currentThread.m_error != null)
throw m_currentThread.m_error;
}
}