| 1 | #include "pthread_impl.h" |
| 2 | #include "atomic.h" |
| 3 | |
| 4 | int pthread_mutex_consistent(pthread_mutex_t *m) |
| 5 | { |
| 6 | 	int old = m->_m_lock; |
| 7 | 	int own = old & 0x3fffffff; |
| 8 | 	if (!(m->_m_type & 4) || !own || !(old & 0x40000000)) |
| 9 | 		return EINVAL; |
| 10 | 	if (own != __pthread_self()->tid) |
| 11 | 		return EPERM; |
| 12 | 	a_and(&m->_m_lock, ~0x40000000); |
| 13 | 	return 0; |
| 14 | } |