头文件里面是这样定义的:
#ifdef __USE_GNU
/* Yield the processor to another thread or process.
This function is similar to the POSIX `sched_yield ' function but
……
[/Quote]
头文件里面是这样定义的:
#ifdef __USE_GNU
/* Yield the processor to another thread or process.
This function is similar to the POSIX `sched_yield' function but
might be differently implemented in the case of a m-on-n thread
implementation. */
extern int pthread_yield (void) __THROW;
/* Limit specified thread TH to run only on the processors represented
in CPUSET. */
extern int pthread_setaffinity_np (pthread_t __th, size_t __cpusetsize,
__const cpu_set_t *__cpuset) __THROW;
/* Get bit set in CPUSET representing the processors TH can run on. */
extern int pthread_getaffinity_np (pthread_t __th, size_t __cpusetsize,
cpu_set_t *__cpuset) __THROW;
#endif
所以你需要定义__USE_GNU宏,可以在源文件里定义:
#define __USE_GNU
也可以加在编译参数里:
gcc -D__USE_GNU -o test test.c -lpthread