*affinity* support


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:

class ThreadCpuBinder
   ThreadCpuBinder(int cpu)
      if(cpu != -1)
          cpu_set_t cpuSet;

          CPU_SET(cpu, &cpuSet);

          if(pthread_setaffinity_np(pthread_self(), sizeof(cpuSet), &cpuSet))
              // error indication

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.

Нет комментариев
Другие идеи
Группа создана, чтобы собирать предложения к стандарту C++, организовывать их внутренние обсуждения, помогать готовить их для отправки в комитет и защищать на общих собраниях в рабочей группе по С++ Международной организации по стандартизации (ISO).
Все предложения