PageRenderTime 81ms CodeModel.GetById 40ms app.highlight 1ms RepoModel.GetById 39ms app.codeStats 0ms

/src/LinFu.AOP.Interfaces/Counter.cs

http://github.com/philiplaureano/LinFu
C# | 29 lines | 26 code | 3 blank | 0 comment | 0 complexity | 6a99e94ebc8b7b9191a38e325806e2ab MD5 | raw file
 1namespace LinFu.AOP.Interfaces
 2{
 3    internal class Counter<T>
 4    {
 5        private readonly object lockObject = new object();
 6        private int _count;
 7
 8        public void Increment()
 9        {
10            lock (lockObject)
11            {
12                _count++;
13            }
14        }
15
16        public void Decrement()
17        {
18            lock (lockObject)
19            {
20                _count--;
21            }
22        }
23
24        public int GetCount()
25        {
26            return _count;
27        }
28    }
29}