コード例 #1
0
        void CloseAndFlush()
        {
            lock (_stateLock)
            {
                if (_unloading)
                {
                    return;
                }

                _unloading = true;
            }
#if !WAITABLE_TIMER
            _timer.Dispose();
#else
            var wh = new ManualResetEvent(false);
            if (_timer.Dispose(wh))
            {
                wh.WaitOne();
            }
#endif

            OnTick();
        }
コード例 #2
0
        void CloseAndFlush()
        {
            lock (_stateLock)
            {
                if (_unloading)
                {
                    return;
                }

                _unloading = true;
            }

            _timer.Dispose();

            OnTick().GetAwaiter().GetResult();
        }