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

int pthread_mutex_lock(pthread_mutex_t *m)
{
5 6 7
	if (m->_m_type == PTHREAD_MUTEX_NORMAL && !a_cas(&m->_m_lock, 0, EBUSY))
		return 0;

8
	return pthread_mutex_timedlock(m, 0);
R
Rich Felker 已提交
9
}