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

pthread_getschedparam(3THR)

pthread_getschedparam(3THR) は、既存のスレッドの優先順位を取得します。


プロトタイプ:
int	 pthread_getschedparam(pthread_t tid, int policy,
    struct schedparam *param);

#include <pthread.h>

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

/* 対象スレッドのスケジューリングパラメタ */
ret = pthread_getschedparam (tid, &policy, &param);

/* sched_priority にスレッドの優先順位が含まれる */
priority = param.sched_priority;

戻り値

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


ESRCH

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