Exemplo n.º 1
0
 private void OnStartingBackgroundWork()
 {
     if (BlockBackgroundWorkStart != null)
     {
         BlockBackgroundWorkStart.Wait();
         BlockBackgroundWorkStart.Reset();
     }
 }
Exemplo n.º 2
0
        public void Dispose()
        {
            _foregroundDispatcher.AssertForegroundThread();

            foreach (var update in _updates)
            {
                if (!update.Value.Task.IsCompleted)
                {
                    update.Value.Cts.Cancel();
                }
            }

            BlockBackgroundWorkStart?.Set();
        }
        public void Dispose()
        {
            _disposed = true;

            foreach (var update in Updates)
            {
                if (!update.Value.Task.IsCompleted &&
                    !update.Value.Cts.IsCancellationRequested)
                {
                    update.Value.Cts.Cancel();
                }
            }

            _semaphore.Dispose();

            BlockBackgroundWorkStart?.Set();
        }