Esempio n. 1
0
 private void Finish(StreamPumpResult result)
 {
     if (callback != null) {
     callback.BeginInvoke(this, result, ir =>
     {
       callback.EndInvoke(ir);
     }, null);
       }
       sem.Release();
 }
Esempio n. 2
0
 private void Finish(StreamPumpResult result)
 {
     if (callback != null)
     {
         callback.BeginInvoke(this, result, ir =>
         {
             callback.EndInvoke(ir);
         }, null);
     }
     sem.Release();
 }
Esempio n. 3
0
 private void Finish(StreamPumpResult result, StreamPumpCallback callback)
 {
     callback?.BeginInvoke(this, result, callback.EndInvoke, null);
     try {
         sem.Release();
     }
     catch (ObjectDisposedException) {
         // ignore
     }
     catch (Exception ex) {
         LogManager.GetLogger(typeof(StreamPump)).Error(ex.Message, ex);
     }
 }
Esempio n. 4
0
 private void Finish(StreamPumpResult result, StreamPumpCallback callback)
 {
   if (callback != null) {
     callback.BeginInvoke(this, result, ir =>
     {
       callback.EndInvoke(ir);
     }, null);
   }
   try {
     sem.Release();
   }
   catch (ObjectDisposedException) {
     // ignore
   }
   catch (Exception ex) {
     LogManager.GetLogger(typeof(StreamPump)).Error(ex.Message, ex);
   }
 }
Esempio n. 5
0
        private void Finish(StreamPumpResult result, StreamPumpCallback callback)
        {
            //https://stackoverflow.com/a/55516918/74071
            var task = Task.Run(() => callback(this, result));

            task.Wait();

            try
            {
                sem.Release();
            }
            catch (ObjectDisposedException)
            {
                // ignore
            }
            catch (Exception ex)
            {
                Trace.WriteLine($"StreamPump.Finish Ex [{ ex.Message }]");
            }
        }