Mono.MicroThreads.Scheduler.AddInternal C# (CSharp) Method

AddInternal() static private method

static private AddInternal ( MicroThread thread ) : void
thread MicroThread
return void
        void AddInternal(MicroThread thread)
        {
            if (m_currentThread == null)
            {
            #if EXTRA_CHECKS
                if(m_previousThread != null || m_scheduledThreadCount != 0)
                    throw new Exception();
            #endif
                m_currentThread = thread;
                m_previousThread = thread;
                thread.m_next = thread;
            }
            else
            {
            #if EXTRA_CHECKS
                if(m_previousThread == null || m_scheduledThreadCount == 0)
                    throw new Exception();
            #endif

                m_previousThread.m_next = thread;
                m_previousThread = thread;
                thread.m_next = m_currentThread;
            }

            m_scheduledThreadCount++;
        }

Usage Example

 public static void Add(MicroThread thread)
 {
     s_scheduler.AddInternal(thread);
 }