System.Net.TimerThread.Prod C# (CSharp) Method

Prod() private static method

Internal mechanism used when timers are added to wake up / create the thread.

private static Prod ( ) : void
return void
        private static void Prod()
        {
            s_ThreadReadyEvent.Set();
            TimerThreadState oldState = (TimerThreadState)Interlocked.CompareExchange(
                ref s_ThreadState,
                (int)TimerThreadState.Running,
                (int)TimerThreadState.Idle);

            if (oldState == TimerThreadState.Idle)
            {
                new Thread(new ThreadStart(ThreadProc)).Start();
            }
        }

Usage Example

示例#1
0
            internal override TimerThread.Timer CreateTimer(TimerThread.Callback callback, object context)
            {
                TimerThread.TimerNode node = new TimerThread.TimerNode(callback, context, base.Duration, this.m_Timers);
                bool flag = false;

                lock (this.m_Timers)
                {
                    if (this.m_Timers.Next == this.m_Timers)
                    {
                        if (this.m_ThisHandle == IntPtr.Zero)
                        {
                            this.m_ThisHandle = (IntPtr)GCHandle.Alloc(this);
                        }
                        flag = true;
                    }
                    node.Next = this.m_Timers;
                    node.Prev = this.m_Timers.Prev;
                    this.m_Timers.Prev.Next = node;
                    this.m_Timers.Prev      = node;
                }
                if (flag)
                {
                    TimerThread.Prod();
                }
                return(node);
            }
All Usage Examples Of System.Net.TimerThread::Prod