예제 #1
0
 void RaiseNewData(object context)
 {
     WinUSBDevice.NewDataCallback cb = NewDataEvent;
     if (cb != null)
     {
         long dataMarker = -1;
         while (dataMarker != TotalReceivedBytes)
         {
             dataMarker = TotalReceivedBytes;
             cb();
         }
     }
 }
예제 #2
0
 void RaiseNewData(object context)
 {
     WinUSBDevice.NewDataCallback cb = NewDataEvent;
     if (cb != null)
     {
         if (EventConcurrency.WaitOne(0)) // Prevent requests from stacking up; Don't issue new events if there are several in flight
         {
             try
             {
                 cb();
             }
             finally
             {
                 EventConcurrency.Release();
             }
         }
     }
 }