#include <thread.h> int thr_suspend(thread_t tid);
线程暂停之后,以后调用 thr_suspend() 将不起任何作用。信号无法唤醒暂停的线程。线程恢复执行之前,信号将一直保持暂挂状态。
在以下概要中,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_suspend(tid); /* using pthreads ID variable with a cast */ ret = thr_suspend((thread_t) ptid);