找不到“pthread_setaffinity_np”?

发布于 2024-12-02 11:23:27 字数 46 浏览 3 评论 0原文

我使用-pthread作为gcc编译器,但仍然找不到这个API。有什么建议吗?

I used -pthread for gcc compiler, but still can not find this API. any suggestion?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我不会写诗 2024-12-09 11:23:28

正如手册和后缀 _np 会告诉您的那样,它是一个非标准 GNU 扩展,因此请包含如下标头:

#define _GNU_SOURCE
#include <pthread.h>

It's a non-standard GNU extension, as the manual and the suffix _np will tell you, so include the header like this:

#define _GNU_SOURCE
#include <pthread.h>
吻安 2024-12-09 11:23:28

您的命令必须如下所示...

$ > gcc -lpthread YourProg.c

如果是 .cpp

则>>

$> g++ -lpthread YourProg.cpp

Your command must looks like this way...

$ > gcc -lpthread YourProg.c

if it is .cpp

then >>

$ > g++ -lpthread YourProg.cpp

风柔一江水 2024-12-09 11:23:28

因为它不是 posix 函数,所以也许你可以在某个地方使用它,而你不能在其他地方使用它。
所以要小心使用它。

because it is not a posix function,so maybe you can use it in somewhere,and you can not use it in some other where.
So carefully use it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文