private void IntiializeDelayedCancel()
 {
     StatusLobby.SetError();
     Timeout.Reset();
     CancelTimer.Restart();
     ParentControl.Disconnect();
 }
Beispiel #2
0
        public void Stop()
        {
            try {
                cancel();
#if UseTask
                //
                // Block GUI requested stops briefly, allowing the search
                // statistics to be written before this request completes.
                //
                const Int32 stopTimeoutMS = 5000;
                if (CancelTimer is not null)
                {
                    CancelTimer.Change(stopTimeoutMS, Timeout.Infinite);
                }

                FinishTask?.Wait();

                //
                //[Note]The old CancellationToken must be recycled after cancel() has been called.
                //
                freeCancellationToken();
#endif
            }
            catch (AggregateException aex) {
                var ex = aex.Flatten();
                //LogLine(ex.ToString());
                throw ex;
            }
        }
Beispiel #3
0
        public void Ponderhit()
        {
            //
            //[Note]This command should only occur while a Ponder Search is in progress, after its
            // "go ponder" command has been issued.  It indicates that the previously hypothetical
            // move was in fact made by the User; and that the search may continue normally.
            //
            // The sequence preceding this "ponderhit" is as follows:
            //
            // When in Ponder Mode, the Engine returns a Ponder Move as well as the Best Move when
            // completing a search.
            //
            // The GUI issues a "go ponder" command, which includes the Ponder Move as part of the
            // starting position for the search; and the command also includes Time Controls to be
            // used in the event that a "ponderhit" command is subsequently handled here.
            //
            // If the Opponent chooses some move other than the Ponder Move, the GUI simply issues
            // a "stop" command to cancel the Ponder Search.  Then the GUI will start a new search
            // from the correct starting position.  Note that this will not be a Ponder Search.
            //
            if (Bound.IsPonder)
            {
                Bound.IsPonder = false; // Cease to Ponder
                var nTimeoutMS = Bound.MoveTime(ExpectedMovesToGo);
                if (nTimeoutMS != Timeout.Infinite)
                {
#if UseTask
                    Debug.Assert(CancelTimer is not null, "Null CancelTimer Instance");
                    //[Note]Timeout.Infinite declares that the CancelTimer should not restart!
                    CancelTimer.Change(nTimeoutMS, Timeout.Infinite);
#endif
                }
            }
        }
Beispiel #4
0
        private void freeCancelTimer()
        {
            if (CancelTimer is not null)
            {
                CancelTimer.Dispose();
                CancelTimer = default;
            }

            // Free CancellationTokenSource referenced by CancelTimer
            freeCancellationToken();
        }
 public override void Update(GameTime gameTime)
 {
     if (Canceled)
     {
         if (CancelTimer == true)
         {
             CancelTimer.Reset();
             Cancel();
         }
     }
     else if (Timeout == true)
     {
         TimeoutActions();
     }
 }
Beispiel #6
0
        public void DoTimer(TimeSpan delay)
        {
            if (this.m_CancelTimer != null)
                this.m_CancelTimer.Stop();

            this.m_CancelTimer = new CancelTimer(this, delay);
            this.m_CancelEnd = DateTime.UtcNow + delay;
            this.m_CancelTimer.Start();
        }
Beispiel #7
0
		public void DoTimer( TimeSpan delay )
		{
			if ( m_CancelTimer != null )
				m_CancelTimer.Stop();

			m_CancelTimer = new CancelTimer(this, delay);
			m_CancelEnd = DateTime.Now + delay;
			m_CancelTimer.Start();
		}
 public override void OnEnter()
 {
     CancelTimer.Reset();
     StatusLobby.ResetStatus();
     Timeout.Restart();
 }