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

任意のスレッドの終了待ち

#include <thread.h>

thread_t tid;
thread_t departedid;
int ret;
int status;

/* スレッド「tid」の終了待ち、status の指定あり */
ret = thr_join(NULL, &departedid, (void **)&status); 

thr_join() でスレッド識別子として NULL を指定すると、プロセス内の切り離されていない任意のスレッドの終了を待ちます。departedid には、終了したスレッドのスレッド識別子が格納されます。