C++ lock_guard_02
Date: 2024-02-27Last modified: 2024-11-02
Table of contents
std::thread t1( func );
std::thread t2( func );
t1.join();
t2.join();
Possible output
140381281089088 👷 spinlock lock start
140381281089088 🕒 while loop...
140381281089088 🚧 spinlock locked
140381272696384 👷 spinlock lock start
140381281089088 🔧 start working
140381272696384 🕒 while loop...
140381281089088 🔧 finish work
140381281089088 🚐 spinlock unlocked
140381272696384 🚧 spinlock locked
140381272696384 🔧 start working
140381272696384 🔧 finish work
140381272696384 🚐 spinlock unlocked