我想更改线程优先级,并且我发现了很多使用 的示例pthread_setschedparam
,但我需要确认如果线程已经在运行,是否可以动态更改优先级。在手册中提及以下内容:
In order for the parameter setting made by
pthread_attr_setschedparam() to have effect when calling
pthread_create(3), the caller must use
pthread_attr_setinheritsched(3) to set the inherit-scheduler
attribute of the attributes object attr to
PTHREAD_EXPLICIT_SCHED.