⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pthread_rwlock_init.c

📁 让你了解Unix进程间的通信是如何实现的
💻 C
字号:
/* include init */#include	"unpipc.h"#include	"pthread_rwlock.h"intpthread_rwlock_init(pthread_rwlock_t *rw, pthread_rwlockattr_t *attr){	int		result;	if (attr != NULL)		return(EINVAL);		/* not supported */	if ( (result = pthread_mutex_init(&rw->rw_mutex, NULL)) != 0)		goto err1;	if ( (result = pthread_cond_init(&rw->rw_condreaders, NULL)) != 0)		goto err2;	if ( (result = pthread_cond_init(&rw->rw_condwriters, NULL)) != 0)		goto err3;	rw->rw_nwaitreaders = 0;	rw->rw_nwaitwriters = 0;	rw->rw_refcount = 0;	rw->rw_magic = RW_MAGIC;	return(0);err3:	pthread_cond_destroy(&rw->rw_condreaders);err2:	pthread_mutex_destroy(&rw->rw_mutex);err1:	return(result);			/* an errno value */}/* end init */voidPthread_rwlock_init(pthread_rwlock_t *rw, pthread_rwlockattr_t *attr){	int		n;	if ( (n = pthread_rwlock_init(rw, attr)) == 0)		return;	errno = n;	err_sys("pthread_rwlock_init error");}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -