开发者

Can not find `pthread_setaffinity_np'?

I used -pthread for gcc compiler, but still 开发者_C百科can not find this API. any suggestion?


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>


Your command must looks like this way...

$ > gcc -lpthread YourProg.c

if it is .cpp

then >>

$ > g++ -lpthread YourProg.cpp


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜