Example #1
0
 public void Dispose()
 {
     if (!_isDisposed.CheckAndSet())
     {
         Cleanup();
     }
 }
Example #2
0
        public void Open()
        {
            if (_opened.CheckAndSet())
            {
                return;
            }

            _listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            _listenSocket.Bind(new IPEndPoint(IPAddressHelper.ParseIPAddress("localhost"), 12345));
            _listenSocket.Listen(1);

            _listenThread = new Thread(Listen);
            _listenThread.Start();
        }
Example #3
0
 public RunOnceState(AtomicFlag flag)
 {
     _flag = flag;
     Run   = !flag.CheckAndSet();
 }