Chapter 7
High Performance Programming
Section 4
Locking One Thread
There are instances where we want to give sole access to a process to a specific thread. We can do this using the lock keyword. This will, therefore, execute this process in a threadsafe manner - Add an object with the private modifier - Add two methods that take an integer of seconds to sleep as a parameter - Create a lock using and then make the thread sleep