#include pthread.h int pthread_getconcurrency(void); /站长网 a
就把传入的参数level设为0.这样,也许会改进机能。 pthread_setconcurrency函数可以用于提醒体系,由于全部的用户级线程都也许被调治到。 假如操纵体系当前正节制着并发度(即之前没有挪用过pthread_setconcurrency函数),假如但愿体系本身抉择行使什么样的并发度。 假如操纵体系的实此刻内核级的线程和用户级的线程之间保持一对一的映射, 并发度节制着用户级线程可以映射的内核线程或历程的数量,那么pthread_getconcurrency将返回0,假如操纵体系的实现让用户级线程到内核级线程或历程之间的映射相关是多对一的话。 那么在给按时刻内增进可运行的用户级线程数,体系并不担保哀求的并发度必然会被回收,,就可以取消在这之前level参数非零的pthread_setconcurrency挪用所发生的浸染, 查察本栏目更多出色内容:http://www.bianceng.cn/OS/unix/ ,不然返回错误编号 pthread_getconcurrency函数返回当前的并发度, #include pthread.h int pthread_getconcurrency(void); //返回值:当前的并发度 int pthread_setconcurrency(int level); //返回值:若乐成则返回0,应用措施挪用level参数为0的pthread_setconcurrency函数, pthread_setconcurrency函数设定的并发度只是对体系的一个提醒。 (编辑:淮北站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |