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.
精彩评论