Last change
on this file since 387 was 352, checked in by coas-nagasima, 6 years ago |
arm向けASP3版ECNLを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
1.1 KB
|
Rev | Line | |
---|
[352] | 1 | #include "pthread_impl.h"
|
---|
| 2 |
|
---|
| 3 | int __pthread_mutex_unlock(pthread_mutex_t *m)
|
---|
| 4 | {
|
---|
| 5 | pthread_t self;
|
---|
| 6 | int waiters = m->_m_waiters;
|
---|
| 7 | int cont;
|
---|
| 8 | int type = m->_m_type & 15;
|
---|
| 9 | int priv = (m->_m_type & 128) ^ 128;
|
---|
| 10 |
|
---|
| 11 | if (type != PTHREAD_MUTEX_NORMAL) {
|
---|
| 12 | self = __pthread_self();
|
---|
| 13 | if ((m->_m_lock&0x7fffffff) != self->tid)
|
---|
| 14 | return EPERM;
|
---|
| 15 | if ((type&3) == PTHREAD_MUTEX_RECURSIVE && m->_m_count)
|
---|
| 16 | return m->_m_count--, 0;
|
---|
| 17 | if (!priv) {
|
---|
| 18 | self->robust_list.pending = &m->_m_next;
|
---|
| 19 | __vm_lock();
|
---|
| 20 | }
|
---|
| 21 | volatile void *prev = m->_m_prev;
|
---|
| 22 | volatile void *next = m->_m_next;
|
---|
| 23 | *(volatile void *volatile *)prev = next;
|
---|
| 24 | if (next != &self->robust_list.head) *(volatile void *volatile *)
|
---|
| 25 | ((char *)next - sizeof(void *)) = prev;
|
---|
| 26 | }
|
---|
| 27 | cont = a_swap(&m->_m_lock, (type & 8) ? 0x7fffffff : 0);
|
---|
| 28 | if (type != PTHREAD_MUTEX_NORMAL && !priv) {
|
---|
| 29 | self->robust_list.pending = 0;
|
---|
| 30 | __vm_unlock();
|
---|
| 31 | }
|
---|
| 32 | if (waiters || cont<0)
|
---|
| 33 | __wake(&m->_m_lock, 1, priv);
|
---|
| 34 | return 0;
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | #ifndef __c2__
|
---|
| 38 | weak_alias(__pthread_mutex_unlock, pthread_mutex_unlock);
|
---|
| 39 | #else
|
---|
| 40 | int pthread_mutex_unlock(pthread_mutex_t *m)
|
---|
| 41 | {
|
---|
| 42 | return __pthread_mutex_unlock(m);
|
---|
| 43 | }
|
---|
| 44 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.