1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| | #include "pthread_impl.h"
int pthread_mutex_destroy(pthread_mutex_t *mutex)
{
/* If the mutex being destroyed is process-shared and has nontrivial
* type (tracking ownership), it might be in the pending slot of a
* robust_list; wait for quiescence. */
if (mutex->_m_type > 128) __vm_wait();
/* Setup a non-robust errorchecking mutex in ownerdead state so
* use after destruction can be trapped. */
mutex->_m_type = 3;
mutex->_m_prev = mutex->_m_next = 0;
mutex->_m_lock = 0x7fffffff;
mutex->_m_count = 0;
return 0;
}
|