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”.
init()
Note that lock() and unlock() are used to synchronize the access to “counter”.