The futex-based implementation of mutexes uses _atomic_lock_t for the
futex. That's a bit of problem as _atomic_lock_t isn't a 32-bit
integer type on sparc64 and landisk. The _atomic_lock_t really is a
special type for spin locks. The futex implementation uses atomic
operations from <sys/atomic.h> though. So the lock member really be a
volatile (unsigned) int. Hence the diff below. This allows me to
switch sparc64 to use the futex-based implementation.
Note that this changes the type from signed to unsigned since
_atomic_lock_t is signed on most of our architectures. As far as I
can tell that's safe. The diff below doesn't introduce any fails in
the libpthread regression test.
ok?
Index: lib/librthread/rthread.h
===================================================================
RCS file: /cvs/src/lib/librthread/rthread.h,v
retrieving revision 1.61
diff -u -p -r1.61 rthread.h
--- lib/librthread/rthread.h 27 May 2017 14:20:39 -0000 1.61
+++ lib/librthread/rthread.h 31 Jul 2017 12:19:01 -0000
@@ -60,7 +60,7 @@ TAILQ_HEAD(pthread_queue, pthread);
#ifdef FUTEX
struct pthread_mutex {
- _atomic_lock_t lock;
+ unsigned int lock;
int type;
pthread_t owner;
int count;
@@ -68,7 +68,7 @@ struct pthread_mutex {
};
struct pthread_cond {
- _atomic_lock_t seq;
+ unsigned int seq;
clockid_t clock;
struct pthread_mutex *mutex;
};