I have implemented a C++ class which launches a separate thread accepting connections (with boost::asio). The whole class is intended to be an asynchronous “command receiver” for a bigger program.
The main trouble is: when waiting for incoming connections, the thread is substantially idle. My perception is that this is wasting processor time (and hardware thread) just doing nothing. Is there any way to execute the thread with a lower priority, or some other way to make the thread not to interfere with the main program, which is both task intensive and threaded?
if you or the class you use is doing an
acceptcall, then the thread is blocked and is waiting for the OS to do some things. SO the thread is (should) not be consuming any CPU ressources, if it does so, it is eitheracceptagain. Ifthere is any parameter to change this, try it!