针对标准符合性提供了 pthread_setconcurrency(3C)。应用程序使用 pthread_setconcurrency() 通知系统其所需的并发级别。对于 Solaris 9 发行版中引入的线程实现,此接口没有任何作用,所有可运行的线程都将被连接到 LWP。
#include <pthread.h> int pthread_setconcurrency(int new_level);
如果出现以下情况,pthread_setconcurrency() 将失败:
EINVAL
描述:new_level 指定的值为负数。
EAGAIN
描述:new_level 指定的值将导致系统资源不足。