Shows how to use xtd::threading::thread_pool class.
#include <xtd/xtd>
namespace wait_handle_example {
class program {
public:
static void main() {
thread_pool::queue_user_work_item({thread_proc});
console::write_line("Main thread does some work, then sleeps.");
thread::sleep(1000);
console::write_line("Main thread exits.");
}
private:
static void thread_proc(any_object state_info) {
console::write_line("Hello from the thread pool.");
}
};
}
startup_(wait_handle_example::program::main);
#define startup_(main_method)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:168