多线程编程指南

继续执行暂停的线程

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() 在成功完成之后返回零。其他任何返回值都表示出现了错误。如果出现以下情况,thr_continue() 将失败并返回对应的值。


ESRCH

描述:

当前的进程中找不到 tid