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

停止しているスレッドの再開

thr_continue(3C) は、停止しているスレッドの実行を再開します。再開したスレッドに対して再度 thr_continue() を発行しても効果はありません。

thr_continue の構文

#include <thread.h>

int thr_continue(thread_t tid);

停止しているスレッドは、シグナルでは呼び起こされません。送られたシグナルは、そのスレッドが thr_continue() で再開されるまで保留されます。

pthread で定義されている pthread_t tid と Solaris スレッドの thread_t tid が同じです。tid 値は、代入によっても型変換によっても使用できます。

thread_t tid; /* tid from thr_create()*/

/* pthreads equivalent of Solaris tid from thread created */
/* with pthread_create()*/
pthread_t ptid;

int ret;

ret = thr_continue(tid);

/* using pthreads ID variable with a cast */
ret = thr_continue((thread_t) ptid) 

thr_continue の戻り値

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


ESRCH

説明:

現在のプロセスに tid が存在しません。