Ejemplo n.º 1
0
 /// <summary>
 /// Entry point for the system thread.
 /// </summary>
 /// <remarks>
 /// Loops calling the thread function enumerator until it exists without a
 /// yield return. Also effects sleeping as returned by the thread function.
 /// </remarks>
 private void ThreadEntry()
 {
     if (_threadFunction != null)
     {
         WorkthreadSleep wait = null;
         while (!_quit && _threadFunction.MoveNext())
         {
             wait = _threadFunction.Current as WorkthreadSleep;
             if (wait != null)
             {
                 System.Threading.Thread.Sleep(wait.Milliseconds);
             }
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Entry point for the system thread.
        /// </summary>
        /// <remarks>
        /// Loops calling the thread function enumerator until it exists without a
        /// yield return. Also effects sleeping as returned by the thread function.
        /// </remarks>
        private void ThreadEntry()
        {
            if (_threadFunction != null)
            {
                WorkthreadSleep wait = null;
                while (!_quit && _threadFunction.MoveNext())
                {
                    wait = _threadFunction.Current as WorkthreadSleep;
                    if (wait != null)
                    {
                        System.Threading.Thread.Sleep(wait.Milliseconds);
                    }

                    if (_suspend)
                    {
                        // Suspend requested
                        _suspendEvent.WaitOne();
                    }
                }
            }
        }