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