For what it's worth, you can also do:

auto m = new Mutex;
sycnchronized (m) {
     // do stuff
}

The synchronized block will call lock on enter and unlock on
exit, even as a result of a throw.

Reply via email to