I want to lock on two objects at the same time. Why can't I write like such code?
lock (obj1, obj2)
Should I always write like that?
lock (obj1) { lock (obj2) { } }
Probably this could be made simpler? Likely it would be better to introduce special private object, and use it for a lock...
Select an object and choose Lock on the context menu or just select the object and use the Ctrl + L (for Windows) or Cmd + L (for Mac) shortcut.
Lock an object in placeSelect the Inspector from the toolbar. In the Inspector, select the Lock tab. Select an object (or objects) on the canvas that you would like to lock. Choose Lock.
Well, this question is way too old but, here is a compact one I figured out, both codes will end up to the same compiled statements (this and the one in the question description):
lock (obj1) lock (obj2) { // your code }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With