/// <summary>
 /// TCP 服务器端同步调用任务处理
 /// </summary>
 protected override void run()
 {
     do
     {
         WaitHandle.Wait();
         while (System.Threading.Interlocked.CompareExchange(ref queueLock, 1, 0) != 0)
         {
             AutoCSer.Threading.ThreadYield.YieldOnly();
         }
         ServerCallBase value = head;
         end  = null;
         head = null;
         System.Threading.Interlocked.Exchange(ref queueLock, 0);
         do
         {
             try
             {
                 while (value != null)
                 {
                     value.RunTask(ref value);
                 }
                 break;
             }
             catch (Exception error)
             {
                 log.Add(Log.LogType.Error, error);
             }
         }while (true);
     }while (!isDisposed);
 }
Beispiel #2
0
 /// <summary>
 /// TCP 服务器端同步调用任务处理
 /// </summary>
 protected override void run()
 {
     do
     {
         WaitHandle.Wait();
         QueueLock.EnterYield();
         ServerCallBase value = head;
         end  = null;
         head = null;
         QueueLock.Exit();
         do
         {
             try
             {
                 while (value != null)
                 {
                     current = null;
                     value.RunTask(ref value);
                 }
                 break;
             }
             catch (Exception error)
             {
                 log.Exception(error, null, LogLevel.Exception | LogLevel.AutoCSer);
             }
         }while (true);
     }while (!isDisposed);
 }
Beispiel #3
0
 /// <summary>
 /// 添加 TCP 任务队列(不允许添加重复的任务实例,否则可能造成严重后果)
 /// </summary>
 /// <param name="call">TCP 服务器端同步调用</param>
 public static void AppendTcpQueue(ServerCallBase call)
 {
     if (call != null)
     {
         if (AutoCSer.Net.TcpServer.ServerCallQueue.Default.CheckAdd(call))
         {
             return;
         }
         throw new InvalidOperationException();
     }
 }
Beispiel #4
0
 /// <summary>
 /// 添加任务队列(不允许添加重复的任务实例,否则可能造成严重后果)
 /// </summary>
 /// <param name="call">TCP 服务器端同步调用</param>
 public void AppendQueue(ServerCallBase call)
 {
     if (call != null)
     {
         if (CallQueue.CheckAdd(call))
         {
             return;
         }
         throw new InvalidOperationException();
     }
 }
Beispiel #5
0
 /// <summary>
 /// TCP 服务器端同步调用任务处理
 /// </summary>
 protected override void run()
 {
     do
     {
         WaitHandle.Wait();
         while (System.Threading.Interlocked.CompareExchange(ref queueLock, 1, 0) != 0)
         {
             AutoCSer.Threading.ThreadYield.YieldOnly();
         }
         ServerCallBase value = head;
         end  = null;
         head = null;
         System.Threading.Interlocked.Exchange(ref queueLock, 0);
         while (value != null)
         {
             value = value.SingleRunTask();
         }
     }while (!isDisposed);
 }