#include <thread.h> thread_t tid; thread_t departedid; int ret; void *status; /* waiting to join any non-detached thread with status */ ret = thr_join(0, &departedid, &status);
通过在 Solaris thr_join() 中使用 0 来表示线程 ID,进程中的任何非分离线程退出时都将执行加入操作。departedid 表示现有线程的线程 ID。