thread_pool2

January 15, 2026 ยท View on GitHub

Shows how to use xtd::threading::thread_pool 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 Main 1) -> start
(Thread Main 1) -> sleep(200)
  (Thread Pool 5) -> count 1
  (Thread Pool 5) -> count 2
(Thread Main 1) -> join all threads of thread_pool
  (Thread Pool 5) -> count 3
  (Thread Pool 5) -> count 4
  (Thread Pool 5) -> count 5
  (Thread Pool 5) -> count 6
  (Thread Pool 5) -> count 7
  (Thread Pool 5) -> count 8
  (Thread Pool 5) -> count 9
  (Thread Pool 5) -> count 10
(Thread Main 1) -> stop