X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fthread%2Fpthread_mutexattr_setrobust.c;h=d06278894a47cd5bb44a1d12e7f525d34ecb777e;hb=546f6b322bcafa2452925c19f9607d9689c75f95;hp=8948cbafbbc88268889d63569abe463fbd11ca71;hpb=b092f1c5fa9c048e12d002c7b972df5ecbe96d1d;p=musl diff --git a/src/thread/pthread_mutexattr_setrobust.c b/src/thread/pthread_mutexattr_setrobust.c index 8948cbaf..d0627889 100644 --- a/src/thread/pthread_mutexattr_setrobust.c +++ b/src/thread/pthread_mutexattr_setrobust.c @@ -4,16 +4,18 @@ void __do_private_robust_list() { pthread_t self = __pthread_self(); - void **p, **prev, **next; + volatile void *volatile *p; + volatile void *volatile *prev; + volatile void *volatile *next; pthread_mutex_t *m; - for (prev=0, p=self->robust_list.head; p; p=next) { + prev = &self->robust_list.head; + for (p=self->robust_list.head; p&&p!=&self->robust_list.head; p=next) { next = *p; m = (void *)((char *)p - offsetof(pthread_mutex_t, _m_next)); if (!(m->_m_type & 128)) { int waiters = m->_m_waiters; - if (prev) *prev = next; - else self->robust_list.head = next; + *prev = next; int cont = a_swap(&m->_m_lock, self->tid|0x40000000); if (cont < 0 || waiters) __wake(&m->_m_lock, 1, 1); } else {