TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
-TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
+TYPEDEF struct { union { int __i[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
-TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
+TYPEDEF struct { union { int __i[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
-TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
+TYPEDEF struct { union { int __i[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
-TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
+TYPEDEF struct { union { int __i[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
-TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
+TYPEDEF struct { union { int __i[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
-TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
+TYPEDEF struct { union { int __i[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[9]; unsigned __s[9]; } __u; } pthread_attr_t;
-TYPEDEF struct { union { int __i[6]; void *__p[6]; } __u; } pthread_mutex_t;
+TYPEDEF struct { union { int __i[6]; volatile void *volatile __p[6]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[12]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[8]; void *__p[8]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[5]; void *__p[5]; } __u; } pthread_barrier_t;
TYPEDEF long long suseconds_t;
TYPEDEF struct { union { int __i[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
-TYPEDEF struct { union { int __i[10]; void *__p[5]; } __u; } pthread_mutex_t;
+TYPEDEF struct { union { int __i[10]; volatile void *volatile __p[5]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[6]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[14]; void *__p[7]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[8]; void *__p[4]; } __u; } pthread_barrier_t;
TYPEDEF long suseconds_t;
TYPEDEF struct { union { int __i[14]; unsigned long __s[7]; } __u; } pthread_attr_t;
-TYPEDEF struct { union { int __i[10]; void *__p[5]; } __u; } pthread_mutex_t;
+TYPEDEF struct { union { int __i[10]; volatile void *volatile __p[5]; } __u; } pthread_mutex_t;
TYPEDEF struct { union { int __i[12]; void *__p[6]; } __u; } pthread_cond_t;
TYPEDEF struct { union { int __i[14]; void *__p[7]; } __u; } pthread_rwlock_t;
TYPEDEF struct { union { int __i[8]; void *__p[4]; } __u; } pthread_barrier_t;
pthread_attr_t attr;
volatile int dead;
struct {
- void **head;
+ volatile void *volatile head;
long off;
- void *pending;
+ volatile void *volatile pending;
} robust_list;
int unblock_cancel;
int timer_id;
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;
}
return EBUSY;
}
- m->_m_next = self->robust_list.head;
+ volatile void *next = self->robust_list.head;
+ m->_m_next = next;
m->_m_prev = &self->robust_list.head;
- if (self->robust_list.head)
- self->robust_list.head[-1] = &m->_m_next;
+ if (next != &self->robust_list.head) *(volatile void *volatile *)
+ ((char *)next - sizeof(void *)) = &m->_m_next;
self->robust_list.head = &m->_m_next;
self->robust_list.pending = 0;
self->robust_list.pending = &m->_m_next;
__vm_lock_impl(+1);
}
- *(void **)m->_m_prev = m->_m_next;
- if (m->_m_next) ((void **)m->_m_next)[-1] = m->_m_prev;
+ volatile void *prev = m->_m_prev;
+ volatile void *next = m->_m_next;
+ *(volatile void *volatile *)prev = next;
+ if (next != &self->robust_list.head) *(volatile void *volatile *)
+ ((char *)next - sizeof(void *)) = prev;
}
cont = a_swap(&m->_m_lock, (type & 8) ? 0x40000000 : 0);
if (type != PTHREAD_MUTEX_NORMAL && !priv) {
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 {