示例#1
0
 /// <summary>
 /// 通知服务端终止回调
 /// </summary>
 public void Dispose()
 {
     //command.CancelKeep(Interlocked.Exchange(ref this.identity, int.MinValue))
     if (isDisposed == 0)
     {
         keepLock.EnterYield();
         if (isDisposed == 0)
         {
             isDisposed = 1;
             keepLock.Exit();
             if (commandIndex != 0)
             {
                 command.CancelKeep(commandIndex);
             }
         }
         else
         {
             keepLock.Exit();
         }
     }
 }
示例#2
0
 /// <summary>
 /// 通知服务端终止回调
 /// </summary>
 public void Dispose()
 {
     //command.CancelKeep(Interlocked.Exchange(ref this.identity, int.MinValue))
     if (isDisposed == 0)
     {
         while (System.Threading.Interlocked.CompareExchange(ref keepLock, 1, 0) != 0)
         {
             AutoCSer.Threading.ThreadYield.Yield(AutoCSer.Threading.ThreadYield.Type.TcpServerKeepCallbackDispose);
         }
         if (isDisposed == 0)
         {
             isDisposed = 1;
             System.Threading.Interlocked.Exchange(ref keepLock, 0);
             if (commandIndex != 0)
             {
                 command.CancelKeep(commandIndex);
             }
         }
         else
         {
             System.Threading.Interlocked.Exchange(ref keepLock, 0);
         }
     }
 }