27 inline static std::atomic<int>
kill_id{-1};
38 active_threads.insert(std::make_pair(worker_id, GetCurrentThread()));
75 stream <<
"I am a worker thread ["
76 << std::this_thread::get_id() <<
"],";
86 if(WAIT_IO_COMPLETION == ::SleepEx(100, TRUE))
95 stream <<
"I am a worker thread ["
96 << std::this_thread::get_id() <<
"],";
147 stream <<
"I am the main thread [" << std::this_thread::get_id()
148 <<
"], doing my own work." <<
tpf::nl;
155 auto hHandle = GetCurrentThread();
157 std::this_thread::sleep_for(std::chrono::seconds(1));
209 catch(
const std::exception& e)
211 std::cerr << e.what() <<
'\n';
std::condition_variable condition_variable
void example_for_wakeup()
register_thread(int worker_id)
static void register_me(int worker_id)
std::unique_lock< mutex_t > unique_lock_t
static void WINAPI worker(int my_id)
std::recursive_mutex recursive_mutex_t
static active_threads_t active_threads
static std::atomic< int > kill_id
static std::condition_variable cv_register
static std::condition_variable cv_unregister
static void unregister_me(int worker_id)
std::map< id_t, handle_t > active_threads_t
static void WINAPI apc_wakeup(ULONG_PTR dwParam)
std::lock_guard< mutex_t > lock_guard_t
std::pair< id_t, handle_t > id_handle_t
Stream output operators << are implemented.