
Understanding thread synchronization in C#
lock (sharedObj1) { … lock (sharedObj2) { … } } Notice that the order of the locks within the Thread2Work technique has been modified to match the order in Thread1Work. First a lock is acquired on sharedObj1, then a lock is acquired on sharedObj2. Right here is the revised model of the whole code itemizing:…