mutex
September 14, 2025 ยท View on GitHub
Shows how to use xtd::threading::mutex class.
Sources
Build and run
Open "Command Prompt" or "Terminal". Navigate to the folder that contains the project and type the following:
xtdc run
Output
thread_1 is requesting the mutex
thread_1 has entered the protected area
thread_2 is requesting the mutex
thread_3 is requesting the mutex
thread_1 is leaving the protected area
thread_1 has released the mutex
thread_2 has entered the protected area
thread_2 is leaving the protected area
thread_2 has released the mutex
thread_3 has entered the protected area
thread_3 is leaving the protected area
thread_3 has released the mutex