Use lock and unlock synchronize the two threads access and increment counter
init()
Note that lock() and unlock() are used to synchronize the access to “counter”.
You are viewing 1/3rd of the document.
Purchase the document to get full access instantly.
init()
Note that lock() and unlock() are used to synchronize the access to “counter”.