1234567891011121314151617181920212223242526272829303132333435 |
- using System.Collections.Concurrent;
- namespace TBL.CSharp.Game.Server.Message;
- /// <summary>
- /// 服务器信号队列
- /// </summary>
- public class SignalQueue : ConcurrentQueue<Signal>
- {
- /// <summary>
- /// 该队列的持有者
- /// </summary>
- public readonly Service Owner;
- /// <summary>
- /// 活跃锁
- /// </summary>
- internal bool ActiveLock;
- public SignalQueue(Service owner)
- {
- Owner = owner;
- ActiveLock = false;
- }
- ~SignalQueue()
- {
- Signal signal;
- while (TryDequeue(out signal))
- {
- if (!signal.Data.IsNullPtr)
- signal.Data.Free();
- }
- }
- }
|