thread2
January 15, 2026 ยท View on GitHub
Shows how to use xtd::threading::thread 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) main -> start
(thread 1) main -> sleep(200_ms)
(thread 2) -> count 1
(thread 2) -> count 2
(thread 1) main -> join thread 2
(thread 2) -> count 3
(thread 2) -> count 4
(thread 2) -> count 5
(thread 2) -> count 6
(thread 2) -> count 7
(thread 2) -> count 8
(thread 2) -> count 9
(thread 2) -> count 10
(thread 1) main -> stop