Перенос предложения: голоса +4, -1
Автор идеи:void78
Currently C++ is not aware of set/get affinity calls.
Given the fact C++ has threads' support out of the box it makes sense to make one step ahead and think about adding that functionality.
Sometime it's crucial for the application to handle incoming events as much as possible.
One of the possible way for that might be 'stealing' CPU core from the OS so does not participate in scheduling and bind your thread to that core.
Sure we can always make kind of cpu binder:
Hope you've got enough with that)
As for me I'd prefer to see 'cpu_set_t' class/struct (or whatever it will be called) which contains CPUs out thread/task/async is allowed to use.
Implementing that sort of class has one important property - backward compatibility: in case you do not care about affinity you can simple ignore that parameter on creating stage.
yndx-antoshkka, 13 июня 2018, 12:14
Появилось предложение на эту тему http://wg21.link/p0796 , но оно сильно привязано к Executors, которые в C++20 скорее всего не попадут.
Перенос предложения: голоса +4, -1 Автор идеи: void78
Currently C++ is not aware of set/get affinity calls. Given the fact C++ has threads' support out of the box it makes sense to make one step ahead and think about adding that functionality.
Sometime it's crucial for the application to handle incoming events as much as possible. One of the possible way for that might be 'stealing' CPU core from the OS so does not participate in scheduling and bind your thread to that core. Sure we can always make kind of cpu binder:
Hope you've got enough with that) As for me I'd prefer to see 'cpu_set_t' class/struct (or whatever it will be called) which contains CPUs out thread/task/async is allowed to use. Implementing that sort of class has one important property - backward compatibility: in case you do not care about affinity you can simple ignore that parameter on creating stage.