void YieldInternal()
{
Print("Yield() 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.Scheduled;
m_previousThread = m_currentThread;
m_currentThread = m_currentThread.m_next;
ScheduleNext();
}
else
{
// We come here when the thread has resumed
//Print("Yield() returned, resuming thread {0}", m_currentThread);
if (m_currentThread.m_error != null)
throw m_currentThread.m_error;
}
}