ManualResetEvent基本上对其他线程说,“只有当收到要继续的信号时,才能继续执行”,并用于暂停某些线程的执行,直到满足特定条件为止。我想问的是,为什么我们可以轻松地使用while循环来实现我们想要的ManualResetEvent呢?考虑以下情况:public BackgroundService() {}
public v
我为此使用了一个ManualResetEvent,但是当我包含同步部分时,它就不会再下载任何东西了(如果没有它,它就能工作)。static int files = 0; static System.Threading.ManualResetEventsync = new System.Threading.ManualResetEvent(true);