private static TaskQueue GetQueue(RoundTimeoutValue timeout)
        {
            TaskQueue result;

            if (_handleQueues.TryGetValue(timeout, out result))
            {
                return(result);
            }
            lock (_handleQueuesRoot)
            {
                if (_handleQueues.TryGetValue(timeout, out result))
                {
                    return(result);
                }

                result = new TaskQueue(timeout);
                var handleQueues = new Dictionary <RoundTimeoutValue, TaskQueue>(_handleQueues);
                handleQueues.Add(timeout, result);
                Thread.MemoryBarrier();
                _handleQueues = handleQueues;
                return(result);
            }
        }
 public TaskQueue(RoundTimeoutValue timeout)
 {
     _timeoutTicks = timeout.Ticks;
     _timer        = new Timer(HandleTimerElapsed);
 }