pthread_rwlock_destroy.c
来自「unix网络编程的源码」· C语言 代码 · 共 33 行
C
33 行
/* include destroy */
#include "unpipc.h"
#include "pthread_rwlock.h"
int
pthread_rwlock_destroy(pthread_rwlock_t *rw)
{
if (rw->rw_magic != RW_MAGIC)
return(EINVAL);
if (rw->rw_refcount != 0 ||
rw->rw_nwaitreaders != 0 || rw->rw_nwaitwriters != 0)
return(EBUSY);
pthread_mutex_destroy(&rw->rw_mutex);
pthread_cond_destroy(&rw->rw_condreaders);
pthread_cond_destroy(&rw->rw_condwriters);
rw->rw_magic = 0;
return(0);
}
/* end destroy */
void
Pthread_rwlock_destroy(pthread_rwlock_t *rw)
{
int n;
if ( (n = pthread_rwlock_destroy(rw)) == 0)
return;
errno = n;
err_sys("pthread_rwlock_destroy error");
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?