Thread Synchronization (b)

Here we talked more knowledge related to thread synchronization, this section mainly on the content of the following four sections:

  1. CountDownEvent
  2. Barrier
  3. ReaderWriterLockSlim
  4. 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

Guess you like

Origin blog.csdn.net/gangzhucoll/article/details/103589628