/// <summary> /// TCP 服务器端同步调用任务处理 /// </summary> protected override void run() { do { WaitHandle.Wait(); QueueLock.EnterYield(); Buffer value = head; end = null; head = null; QueueLock.Exit(); do { try { while (value != null) { value.OnPacket(ref value, onPacket); } break; } catch (Exception error) { log.Exception(error, null, LogLevel.Exception | LogLevel.AutoCSer); } }while (true); }while (!isDisposed); }
/// <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); }
/// <summary> /// TCP 服务器端同步调用任务处理 /// </summary> protected override void run() { do { WaitHandle.Wait(); while (System.Threading.Interlocked.CompareExchange(ref queueLock, 1, 0) != 0) { AutoCSer.Threading.ThreadYield.YieldOnly(); } ClientCommand.CommandBase value = head; end = null; head = null; System.Threading.Interlocked.Exchange(ref queueLock, 0); do { try { do { value.OnReceiveTask(ref value); }while (value != null); break; } catch (Exception error) { AutoCSer.Log.Pub.Log.Add(Log.LogType.Error, error); } }while (value != null); }while (true); }
/// <summary> /// 锁操作任务处理 /// </summary> protected override void run() { do { WaitHandle.Wait(); while (System.Threading.Interlocked.CompareExchange(ref queueLock, 1, 0) != 0) { AutoCSer.Threading.ThreadYield.YieldOnly(); } Node value = head; end = null; head = null; System.Threading.Interlocked.Exchange(ref queueLock, 0); do { try { do { value = value.RunTask(); }while (value != null); break; } catch (Exception error) { value.Lock.Cache.TcpServer.AddLog(error); } value = value.LinkNext; }while (value != null); }while (true); }
/// <summary> /// TCP 服务器端同步调用任务处理 /// </summary> protected override void run() { do { WaitHandle.Wait(); while (System.Threading.Interlocked.CompareExchange(ref queueLock, 1, 0) != 0) { AutoCSer.Threading.ThreadYield.YieldOnly(); } Buffer value = head; end = null; head = null; System.Threading.Interlocked.Exchange(ref queueLock, 0); do { try { while (value != null) { onPacket(value); value = value.LinkNext; } break; } catch (Exception error) { log.Add(Log.LogType.Error, error); } value = value.LinkNext; }while (true); }while (!isDisposed); }
/// <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) { current = null; value.RunTask(ref value); } break; } catch (Exception error) { log.Add(Log.LogType.Error, error); } }while (true); }while (!isDisposed); }
/// <summary> /// TCP 服务器端同步调用任务处理 /// </summary> protected override void run() { do { WaitHandle.Wait(); QueueLock.EnterYield(); ClientCommand.CommandBase value = head; end = null; head = null; QueueLock.Exit(); do { try { do { value.OnReceiveTask(ref value); }while (value != null); break; } catch (Exception error) { AutoCSer.LogHelper.Exception(error, null, LogLevel.Exception | LogLevel.AutoCSer); } }while (value != null); }while (true); }
public override Task Begin(object obj, SynchronousOptions opts = null) { return(Task.Run(() => { if (WillBegin(obj, opts)) { OnBegun(obj, opts); WaitHandle.Wait(); } })); }
public override T GetResult() { if (!IsCompleted) { WaitHandle.Wait(); } if (exception != null) { exception.Throw(); } return(result); }
/// <summary> /// TCP 服务器端同步调用任务处理 /// </summary> protected override void run() { do { WaitHandle.Wait(); while (System.Threading.Interlocked.CompareExchange(ref queueLock, 1, 0) != 0) { AutoCSer.Threading.ThreadYield.YieldOnly(); } ClientCommand.CommandBase value = head; end = null; head = null; System.Threading.Interlocked.Exchange(ref queueLock, 0); do { value = value.OnReceiveTask(); }while (value != null); }while (true); }
/// <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); }
public Task NotifyAll(bool state) { if (state) { return(Task.Run(() => { m_allNotified?.Invoke(Id, state); WaitHandle.Set(); })); } else { return(Task.Run(() => { m_allNotified?.Invoke(Id, state); WaitHandle.Wait(); })); } }
/// <summary> /// TCP 服务器端同步调用任务处理 /// </summary> protected internal override void run() { do { CurrentTaskTimestamp = threadArray.NoSwitchTimestamp; WaitHandle.Wait(); ServerCallBase value = Interlocked.Exchange(ref Head, null); do { try { do { value.RunTask(ref value, ref CurrentTaskTimestamp); }while (value != null); break; } catch (Exception error) { AutoCSer.LogHelper.Exception(error); } }while (value != null); }while (true); }
public void Wait() { WaitHandle.Wait(TimeSpan.FromSeconds(10)); WaitHandle.Reset(); }