L
Laura T.
To synchronize thread access to shared objects, I've always used the
lock(shared_object) { } pattern.
I've seen many recommendations and examples where to synchronize use
lock(another_object) { use shared_object; } pattern.
I do not see any reason to have another simple object to lock for since I
can lock the shared object directly.
Are there any deep implications to use shared lock object to guard the
actual shared object, maybe performance oriented?
Which is better, if it can be measured?
TIA,
LT
lock(shared_object) { } pattern.
I've seen many recommendations and examples where to synchronize use
lock(another_object) { use shared_object; } pattern.
I do not see any reason to have another simple object to lock for since I
can lock the shared object directly.
Are there any deep implications to use shared lock object to guard the
actual shared object, maybe performance oriented?
Which is better, if it can be measured?
TIA,
LT