Mono.MicroThreads.Scheduler.ManageSleepers C# (CSharp) Méthode

ManageSleepers() private méthode

private ManageSleepers ( ) : int
Résultat int
        int ManageSleepers()
        {
            if (m_sleepingThreadCount == 0)
            {
            #if EXTRA_CHECKS
                if(m_firstSleepingThread != null)
                    throw new Exception();
            #endif
                return -1;
            }

            long now = DateTime.UtcNow.Ticks;

            MicroThread t = m_firstSleepingThread;

            while(t != null && t.m_wakeTime < now)
            {
                MicroThread next = t.m_next;

                t.m_state = MicroThreadState.Scheduled;
                m_sleepingThreadCount--;

                AddInternal(t);

                t = next;
            }

            m_firstSleepingThread = t;

            if (m_firstSleepingThread == null)
                return -1;
            else
            {
                long wait = m_firstSleepingThread.m_wakeTime - now;
                return (int)TimeSpan.FromTicks(wait).TotalMilliseconds;
            }
        }