/// <summary> /// 释放资源 /// </summary> public void Dispose() { if (System.Threading.Interlocked.CompareExchange(ref isPushEvents, 0, 1) == 1) { OnTimerLink.PopNotNull(this); } Unmanaged.Free(ref Counts); }
/// <summary> /// 超时计数 /// </summary> /// <param name="maxSeconds">最大超时秒数,必须大于 0</param> internal TimeoutCount(int maxSeconds) { if (maxSeconds > 0) { Counts = Unmanaged.GetSize64((maxSeconds + 2) << 2, true); Counts.CustomSize = Counts.ByteSize >> 2; OnTimerLink.PushNotNull(this); isPushEvents = 1; } }