标题: Solaris 线程编程 3................................. [打印本页] 作者: BonardGalton 时间: 2011-12-22 16:21 标题: Solaris 线程编程 3.................................
Solaris 线程编程 3...........................
进程内条件变量
#include <thread.h>cond_t cv;int ret;/* to be used within this process only */ret = cond_init(cv, USYNC_THREAD, 0);
进程间条件变量
#include <thread.h>cond_t cv;int ret;/* to be used among all processes */ret = cond_init(&cv, USYNC_PROCESS, 0);
cond_init 返回值
cond_init() 在成功运行后返回 0。如果检测到以下任一情况,cond_init() 将失败并返回对应的值。
进程内信号
#include <thread.h>sema_t sp;int ret;int count;count = 4;/* to be used within this process only */ret = sema_init(&sp, count, USYNC_THREAD, 0);
进程间信号
#include <thread.h>sema_t sp;int ret;int count;count = 4;/* to be used among all the processes */ret = sema_init (&sp, count, USYNC_PROCESS, 0);
sema_init 返回值
sema_init() 在成功运行后返回 0。如果检测到以下任一情况,sema_init() 将失败并返回对应的值。