X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=inline;f=src%2Fthread%2Fpthread_mutex_trylock.c;h=54876a619fb1238a3a37dd8346fbbf615152b263;hb=5b5db97f7e80bde2678aed72336a28375e800354;hp=cb93565194a1cc519b26051fe3f8e65cafec4217;hpb=df7d0dfb9c686df31149d09008ba92834bed9803;p=musl diff --git a/src/thread/pthread_mutex_trylock.c b/src/thread/pthread_mutex_trylock.c index cb935651..54876a61 100644 --- a/src/thread/pthread_mutex_trylock.c +++ b/src/thread/pthread_mutex_trylock.c @@ -7,12 +7,6 @@ int __pthread_mutex_trylock_owner(pthread_mutex_t *m) pthread_t self = __pthread_self(); int tid = self->tid; - if (!self->robust_list.off) { - __syscall(SYS_set_robust_list, &self->robust_list, 3*sizeof(long)); - self->robust_list.head = &self->robust_list.head; - self->robust_list.off = (char*)&m->_m_lock-(char *)&m->_m_next; - } - old = m->_m_lock; own = old & 0x7fffffff; if (own == tid && (type&3) == PTHREAD_MUTEX_RECURSIVE) { @@ -20,9 +14,13 @@ int __pthread_mutex_trylock_owner(pthread_mutex_t *m) m->_m_count++; return 0; } - if (own == 0x40000000) return ENOTRECOVERABLE; + if (own == 0x7fffffff) return ENOTRECOVERABLE; if (m->_m_type & 128) { + if (!self->robust_list.off) { + self->robust_list.off = (char*)&m->_m_lock-(char *)&m->_m_next; + __syscall(SYS_set_robust_list, &self->robust_list, 3*sizeof(long)); + } if (m->_m_waiters) tid |= 0x80000000; self->robust_list.pending = &m->_m_next; }