C# equivalent to java’s wait and notify?

The equivalent functionality (including the normal locking) is in the Monitor class.

foo.notify() => Monitor.Pulse(foo)
foo.notifyAll() => Monitor.PulseAll(foo)
foo.wait() =>  Monitor.Wait(foo)

The lock statement in C# is equivalent to calling Monitor.Enter and Monitor.Exit with an appropriate try/finally block.

See my threading tutorial or Joe Albahari’s one for more details.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)