jeudi 18 juin 2020

Set a higher priority to a boost::asio thread wrt the process

I know that C++ has some ways to set priority on threads. Something like what is is being discussed here. Similar to that, is there something similar available in threads that boost::asio runs? I am doing an async_read and async_write to read and write data from the network.

Note that I do want to set priority betweeen the read and write like described here in boost::asio example. I rather want to set a higher priority to the asio reader thread with respect to the whole process.

If boost::asio doesn't provide a direct mechanism to higher the priority of its thread(s), then is possible that I create the std::thread, set a higher priority to it like discussed here and provide it to asio to use it for async_read/async_write? Or is this possible with a strand?

Environment:
I am using boost 1.68 with a C++11 compiler.

Aucun commentaire:

Enregistrer un commentaire