V
valentin tihomirov
It is quite convenient to use the basic primitive:
lock(object) {
method();
}
On the other hand,
rwLock.AcquireReaderLock(-1);
try { // unlock finally
method();
} finally {
rwLock.ReleaseReaderLock();
}
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.AcquireReaderLock(-1);
try { // unlock finally
method();
} finally {
rwLock.ReleaseReaderLock();
}
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?