Ejemplo n.º 1
0
 /// <summary>
 /// Executes the operation loop.
 /// Returns when stopped.
 /// </summary>
 private void Start()
 {
     lock (contextSync) {
         if (!context.Create())
         {
             // TODO: make this visible in UI
             LogManager.Instance.Log(LogEntry.CreateError(this, "Cannot inject events to OS"));
         }
     }
     while (stopSignal < 1)
     {
         if (Interlocked.CompareExchange(ref invokeSignal, 0, 1) == 1)
         {
             InvokePending();
         }
         if (Interlocked.CompareExchange(ref sendSignal, 0, 1) == 1)
         {
             SendState();
         }
         HandleFTRequest();
         Thread.Sleep(1);
     }
     InvokePending();
     SendState();
     context.Destroy();
     Interlocked.Decrement(ref stopSignal);
     ftRequestNo = 0;
     HandleFTRequest();
 }