예제 #1
0
        public void Shutdown(bool wait = true)
        {
            lock (Lock)
            {
                _state = ThreadState.StopRequested;
            }

            ShutdownEvent.Set();
            ResumeEvent.Set();
            Thread.Join();
        }
예제 #2
0
        public bool ExecuteContext(IThreadContext context)
        {
            bool successfulInvoke = false;

            lock (Lock)
            {
                successfulInvoke = context != null && _state == ThreadState.Suspended;
                if (successfulInvoke)
                {
                    Context = context;
                    _state  = ThreadState.Running;
                    ResumeEvent.Set();
                }
            }

            return(successfulInvoke);
        }
예제 #3
0
 public void Resuming()
 {
     Contract.Assert(isPaused);
     isPaused = false;
     ResumeEvent.Set();
 }
예제 #4
0
 public void Resuming()
 {
     Debug.Assert(isPaused);
     isPaused = false;
     ResumeEvent.Set();
 }
예제 #5
0
        public void Resume()
        {
            PauseEvent.Reset();

            ResumeEvent.Set();
        }