Here we talked more knowledge related to thread synchronization, this section mainly on the content of the following four sections:
- CountDownEvent
- Barrier
- ReaderWriterLockSlim
- SpinWait
Zero, CountDownEvent
CountdownEvent is a synchronization primitives, which after a certain number of received signal, it will lift the lock waiting threads. It must be used for general ManualResetEvent or ManualResetEventSlim and must be in the case of a decreasing variable manually before signaling events, simply means that is mainly used in case of need to wait for multiple asynchronous operation to complete.
using System;
using System.Threading;
using static System.Console;
using static System.Threading.Thread