pthread_mutex_lock.c 361 字节
Newer Older
R
Rich Felker 已提交
1 2
#include "pthread_impl.h"

3 4 5
int __pthread_mutex_timedlock(pthread_mutex_t *restrict, const struct timespec *restrict);

int __pthread_mutex_lock(pthread_mutex_t *m)
R
Rich Felker 已提交
6
{
7 8
	if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL
	    && !a_cas(&m->_m_lock, 0, EBUSY))
9 10
		return 0;

11
	return __pthread_mutex_timedlock(m, 0);
R
Rich Felker 已提交
12
}
13 14

weak_alias(__pthread_mutex_lock, pthread_mutex_lock);