aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Threading/CommonTimer.cs
blob: 9451b07f3289bbe3b1421cdfe043a61d13ed44c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Threading;
using MediaBrowser.Model.Threading;

namespace Emby.Server.Implementations.Threading
{
    public class CommonTimer : ITimer
    {
        private readonly Timer _timer;

        public CommonTimer(Action<object> callback, object state, TimeSpan dueTime, TimeSpan period)
        {
            _timer = new Timer(new TimerCallback(callback), state, dueTime, period);
        }

        public CommonTimer(Action<object> callback, object state, int dueTimeMs, int periodMs)
        {
            _timer = new Timer(new TimerCallback(callback), state, dueTimeMs, periodMs);
        }

        public void Change(TimeSpan dueTime, TimeSpan period)
        {
            _timer.Change(dueTime, period);
        }

        public void Change(int dueTimeMs, int periodMs)
        {
            _timer.Change(dueTimeMs, periodMs);
        }

        public void Dispose()
        {
            _timer.Dispose();
        }
    }
}