AutoResetEvent, ManualResetEvent vs Monitor

后端 未结 3 939
我寻月下人不归
我寻月下人不归 2020-12-30 03:41

Lets say I have to orchestrate a synchronization algorithm in .Net 3.5 SP1 and any of the synchronization primitives listed in the title fit perfectly for the task.

3条回答
  •  粉色の甜心
    2020-12-30 04:32

    If you can, go with Monitor. It's similar to a CRITICAL_SECTION. AutoResetEvent/ManualResetEvent might have slightly more overhead, since these can be shared by different processes, whereas a Monitor belongs to a single process.

提交回复
热议问题