C# lock statement, what object to lock on?
How and what you lock on depends upon what you’re doing. Let’s say that you’re working with a device of some kind – say a coffee maker. You might have a class that looks like this: public CoffeeMaker { private IntPtr _coffeeHandle; private Object _lock = new Object(); } In this case, you are protecting … Read more