マルチスレッドのプログラミング

スレッドの方針およびスケジューリングパラメータの取得

pthread_getschedparam(3C) は、個々のスレッドのスケジューリングポリシーおよびスケジューリングパラメータを取得します。

pthread_getschedparam の構文

int  pthread_getschedparam(pthread_t tid, int *restrict policy,
    struct sched_param *restrict param);
#include <pthread.h>

pthread_t tid;
sched_param param;
int priority;
int policy;
int ret;

/* scheduling parameters of target thread */
ret = pthread_getschedparam (tid, &policy, &param);

/* sched_priority contains the priority of the thread */
priority = param.sched_priority; 

pthread_getschedparam の戻り値

pthread_getschedparam() は、正常終了時に 0 を返します。それ以外の戻り値は、エラーが発生したことを示します。以下の条件が検出されると、この関数は失敗し、次の値を返します。


ESRCH

説明:

tid で指定した値が既存のスレッドを表していません。