Background task (#27)
Background task (#27)

* Fix spelling of _visibleDescendants

* Ensure that ProgressBar.Dispose only runs once

The Dispose pattern in .NET generally allows for Dispose() to be called multiple times. This does so in a thread-safe way.

There is not an overload of InterlockedCompareExchange() that takes bool, so _isDisposed had to be changed to integer.

* Perform all console updates on single background task

This creates a new background task for the ProgressBar class. All console update will be run in this task's thread.

This is done to workaround performance issues of System.Console. Using System.Console is especially slow on .NET Core 2.x runtime on Linux. Since all calls to Tick() were blocking until the console was updated, this really slowed down any application trying to use this library.

Now, each call to tick just wakes up the background task before returning. This way callers aren't affected by differences in System.Console performance.

* Allow WaitOne to be interrupted through a timeout.

mark readonly fields explicitly

Mpdreamz/shellprogressbar