Disable testandset() locks, use pthread's as SheepShaver occasionnally hangs

with spinlocks. Weird as those are derived from x86 linuxthreads.
This commit is contained in:
gbeauche 2004-06-02 16:11:49 +00:00
parent 76c06c52e0
commit bf17f78ac4

View File

@ -249,7 +249,8 @@ static inline int testandset(volatile int *p)
}
#endif
#if defined(__i386__) || defined(__x86_64__)
/* FIXME: SheepShaver occasionnally hangs with those locks */
#if 0 && (defined(__i386__) || defined(__x86_64__))
#define HAVE_TEST_AND_SET 1
static inline int testandset(volatile int *p)
{
@ -328,12 +329,12 @@ static inline int testandset(volatile int *p)
#endif /* __GNUC__ */
#if HAVE_TEST_AND_SET
#define HAVE_SPINLOCKS 1
typedef volatile int spinlock_t;
static const spinlock_t SPIN_LOCK_UNLOCKED = 0;
#if HAVE_TEST_AND_SET
#define HAVE_SPINLOCKS 1
static inline void spin_lock(spinlock_t *lock)
{
while (testandset(lock));
@ -348,6 +349,19 @@ static inline int spin_trylock(spinlock_t *lock)
{
return !testandset(lock);
}
#else
static inline void spin_lock(spinlock_t *lock)
{
}
static inline void spin_unlock(spinlock_t *lock)
{
}
static inline int spin_trylock(spinlock_t *lock)
{
return 1;
}
#endif
// Time data type for Time Manager emulation