开发者

Purpose Of Monitor.Pulse

I just want to make sure I understand something here. If I obtain a lock with Monitor.Enter or lock do I need to call Pulse before releasing the lock?

Monitor.Enter

Monitor.Pulse // Is that neccessary?

Monitor.Exit

I was always led to believe that a Monitor.Exit call would implicitly invoke Monitor.Pulse. Is that actually true?

I'm not exactly sure when wou开发者_运维知识库ld you would use Pulse. That is what is causing confusion.


No, you don't need to call Pulse... but it won't be done automatically when you exit, either.

Pulse and PulseAll are used in conjunction with Wait for signalling purposes.

See the second half of this page for more details (ignore the deadlocking bit, basically :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜