Example #1
0
        internal static void TestHybridLockPerf()
        {
            HRTimer timer = HRTimer.CreateAndStart();

            LightLock hl = new LightLock();

            int y = 0;

            Parallel.For(0, ITERATIONS_COUNT, i =>
            {
                hl.WaitOne();
                y++;
                hl.Set();
            });

            System.Console.WriteLine(y.ToString());
            System.Console.WriteLine(timer.StopWatch());
        }
Example #2
0
        public void Close()
        {
            lock (this)
            {
                if (Closed)
                {
                    return;
                }

                Closed = true;

                ActionSendSync.WaitOne();

                if (Socket != null && Socket.Connected)
                {
                    Socket.Disconnect(true);
                    Socket.Close();
                    Socket = null;
                }

                ResetReceive();
                ResetSend();
            }
        }