Esempio n. 1
0
 public NetworkClient(TcpClient tcpClient)
 {
     this.tcpClient = tcpClient;
     ns             = tcpClient.GetStream();
     messageQueue   = new Locked <Queue <NetworkData> >(new Queue <NetworkData>());
     sendQueue      = new Locked <Queue <NetworkData> >(new Queue <NetworkData>());
     cancel         = new CancellationTokenSource();
     waitMessage    = new Waiter();
     cancel.Token.Register(FullClose);
     listenTask    = Task.Run(Listen);
     keepAliveTask = Task.Run(KeepAlive);
     sendTask      = Task.Run(SendLoop);
 }
Esempio n. 2
0
 public LockedValue(Locked <TVal> instance, TVal value)
 {
     this.instance = instance;
     this.Value    = value;
 }