📄 pthread_rwlock_tryrdlock.c
字号:
/* include tryrdlock */#include "unpipc.h"#include "pthread_rwlock.h"intpthread_rwlock_tryrdlock(pthread_rwlock_t *rw){ int result; if (rw->rw_magic != RW_MAGIC) return(EINVAL); if ( (result = pthread_mutex_lock(&rw->rw_mutex)) != 0) return(result); if (rw->rw_refcount == -1 || rw->rw_nwaitwriters > 0) result = EBUSY; /* held by a writer or waiting writers */ else rw->rw_refcount++; /* increment count of reader locks */ pthread_mutex_unlock(&rw->rw_mutex); return(result);}/* end tryrdlock */intPthread_rwlock_tryrdlock(pthread_rwlock_t *rw){ int n; if ( (n = pthread_rwlock_tryrdlock(rw)) != 0) { errno = n; err_sys("pthread_rwlock_tryrdlock error"); } return(n);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -