[asio-users] select_reactor::run_thread
Brought to you by:
chris_kohlhoff
From: eugeny g. <jo...@dr...> - 2022-10-24 17:13:58
|
Hi, the code #if defined(ASIO_HAS_IOCP) void select_reactor::run_thread() { asio::detail::mutex::scoped_lock lock(mutex_); while (!stop_thread_) { lock.unlock(); op_queue<operation> ops; run(true, ops); scheduler_.post_deferred_completions(ops); lock.lock(); } } is to be at least void select_reactor::run_thread() { asio::detail::mutex::scoped_lock lock(mutex_); while (!stop_thread_) { lock.unlock(); op_queue<operation> ops; run(1, ops); scheduler_.post_deferred_completions(ops); lock.lock(); } } yep, it’s just cosmetic changing. but there we have a big problem - the thread will wake up every 1ms (mks?) and consume the CPU time in the usually empty loop. -- Yours sincerely, Eugeny. +33 6 38 52 27 93 |