Esempio n. 1
0
        public static ConcurrentInt64 operator +(ConcurrentInt64 left, ConcurrentInt64 right)
        {
            ConcurrentInt64 add = left;

            add.Value = left.Value + right.Value;
            return(add);
        }
Esempio n. 2
0
        public ThreadingTimer(int period = 0, int delay = 0)
        {
            _delay = 0;
            if (period <= 0)
            {
                throw new ArgumentException("No negative or zero allowed", "period");
            }
            if (delay < 0)
            {
                throw new ArgumentException("No negative or zero allowed", "delay");
            }

            if (delay > 0)
            {
                _delay = delay;
            }
            _period   = period;
            _delay    = delay;
            _timer    = new Timer(OnTimerElapsed, this, Timeout.Infinite, Timeout.Infinite);
            _timesRun = new ConcurrentInt64();
            _running  = new ConcurrentInt64();
        }
Esempio n. 3
0
        public SystemTimer(int period = 0, int delay = 0)
        {
            _delay = 0;
            if (period <= 0)
            {
                throw new ArgumentException("No negative or zero allowed", "period");
            }
            if (delay < 0)
            {
                throw new ArgumentException("No negative or zero allowed", "delay");
            }

            if (delay > 0)
            {
                _delay = delay;
            }
            _period         = period;
            _delay          = delay;
            _timesRun       = new ConcurrentInt64();
            _running        = new ConcurrentInt64();
            _timer          = new Timer(_period);
            _timer.Elapsed += OnTimerElapsed;
        }