public void Dispose() { if (!_isDisposed.CheckAndSet()) { Cleanup(); } }
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(); }
public RunOnceState(AtomicFlag flag) { _flag = flag; Run = !flag.CheckAndSet(); }