如何将boost线程分配给核心 [英] How to assign a boost thread to core

查看:90
本文介绍了如何将boost线程分配给核心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我要为boost :: thread_group线程分配一个核心,但如何分配是他们可以分配的任何API。



我尝试过:



i试图创建pthread_setaffinity_np但是get_id()无法分配给pthread

Hi,
Im tring to assign a core for boost::thread_group thread but how to assign is their is any API available to assign.

What I have tried:

i tried to create pthread_setaffinity_np but get_id() cannot able to assign to pthread

推荐答案

这里有一些见解: C ++ 11线程,亲和力和超线程 - Eli Bendersky的网站 [ ^ ]。

虽然提升缺少 API 为此,有提供功能的库(参见关于可移植性的说明部分)。
Here some insight: C++11 threads, affinity and hyperthreading - Eli Bendersky's website[^].
While boost lacks an API for that, there are libraries providing the functionality (see the "A note on portability" section).


这篇关于如何将boost线程分配给核心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆