It is quite convenient to use the basic primitive:
lock(object) {
method();
}
On the other hand,
rwLock.AcquireR eaderLock(-1);
try { // unlock finally
method();
} finally {
rwLock.ReleaseR eaderLock();
}
is much less cosy but is typical scenario, I beleive. I would prefer:
rwLock.RLock(-1) {
method();
}
instead. Why not to introduce the utility methods?
lock(object) {
method();
}
On the other hand,
rwLock.AcquireR eaderLock(-1);
try { // unlock finally
method();
} finally {
rwLock.ReleaseR eaderLock();
}
is much less cosy but is typical scenario, I beleive. I would prefer:
rwLock.RLock(-1) {
method();
}
instead. Why not to introduce the utility methods?
Comment