相关疑难解决方法(0)

ManualResetEventSlim:调用.Set()后紧跟.Reset()不释放*any*等待线程

ManualResetEventSlim:立即调用.Set()后跟.Reset()不会释放任何等待的线程

(注意:这也适用于ManualResetEvent,而不仅仅是ManualResetEventSlim.)

我在发布和调试模式下都尝试了下面的代码.我在四核处理器上运行的Windows 7 64位上使用.Net 4运行32位版本.我是从Visual Studio 2012编译的(所以安装了.Net 4.5).

我在系统上运行时的输出是:

Waiting for 20 threads to start
Thread 1 started.
Thread 2 started.
Thread 3 started.
Thread 4 started.
Thread 0 started.
Thread 7 started.
Thread 6 started.
Thread 5 started.
Thread 8 started.
Thread 9 started.
Thread 10 started.
Thread 11 started.
Thread 12 started.
Thread 13 started.
Thread 14 started.
Thread 15 started.
Thread 16 started.
Thread 17 started.
Thread 18 started.
Thread …
Run Code Online (Sandbox Code Playgroud)

c# multithreading

13
推荐指数
1
解决办法
3847
查看次数

标签 统计

c# ×1

multithreading ×1