Suppose I have two objects a and b.
I want to SyncLock on both objects.
Is this feasible? Can it be done by nested SyncLock statements? What are the dangers of such an operation?
Edit
Perhaps I should ask, how can one refactor to avoid deadlocks?
It's possible to do but you need to consider what happens if 2 threads running this code try to get both locks at the same time - eg if thread 1 has a lock on object 1 and thread 2 has a lock on object 2? Cue deadlock.
Someone better than I can give you some example code that should be safe :)