public void EnterTest()
        {
            int i = 0, k = 0;
            var locker = new OmniLocker();

            void action()
            {
                foreach (var _ in Enumerable.Range(0, 10))
                {
                    using (var ctx = locker.Enter())
                    {
                        var j = i;
                        output.WriteLine($"{Thread.CurrentThread.ManagedThreadId}: read {j}.");
                        Thread.Sleep(100);
                        i = j + 1;
                        output.WriteLine($"{Thread.CurrentThread.ManagedThreadId}: write {j + 1}.");
                        Interlocked.Increment(ref k);
                    }
                }
            }

            var t1 = Task.Run(action);
            var t2 = Task.Run(action);
            var t3 = Task.Run(action);

            t1.Wait();
            t2.Wait();
            t3.Wait();

            Assert.Equal(k, i);
        }
        public void EnterBenchmark()
        {
            var duration = TimeSpan.FromSeconds(5);
            var locker   = new OmniLocker();

            int count = 0;

            void increment(ref int i)
            {
                var sw = Stopwatch.StartNew();

                while (sw.Elapsed < duration)
                {
                    using (var locked = locker.Enter())
                        i++;
                }
            }

            var list = new List <Thread>();

            for (int i = 0; i < 4; i++)
            {
                list.Add(new Thread(new ThreadStart(() => increment(ref count))));
            }

            foreach (var t in list)
            {
                t.Start();
            }

            foreach (var t in list)
            {
                t.Join();
            }

            output.WriteLine($"{count} iteration in {duration}.");

            Assert.True(true);
        }