249 |
|
} |
250 |
|
#endif |
251 |
|
|
252 |
< |
#if defined(__i386__) || defined(__x86_64__) |
252 |
> |
/* FIXME: SheepShaver occasionnally hangs with those locks */ |
253 |
> |
#if 0 && (defined(__i386__) || defined(__x86_64__)) |
254 |
|
#define HAVE_TEST_AND_SET 1 |
255 |
|
static inline int testandset(volatile int *p) |
256 |
|
{ |
329 |
|
|
330 |
|
#endif /* __GNUC__ */ |
331 |
|
|
331 |
– |
#if HAVE_TEST_AND_SET |
332 |
– |
#define HAVE_SPINLOCKS 1 |
332 |
|
typedef volatile int spinlock_t; |
333 |
|
|
334 |
|
static const spinlock_t SPIN_LOCK_UNLOCKED = 0; |
335 |
|
|
336 |
+ |
#if HAVE_TEST_AND_SET |
337 |
+ |
#define HAVE_SPINLOCKS 1 |
338 |
|
static inline void spin_lock(spinlock_t *lock) |
339 |
|
{ |
340 |
|
while (testandset(lock)); |
349 |
|
{ |
350 |
|
return !testandset(lock); |
351 |
|
} |
352 |
+ |
#else |
353 |
+ |
static inline void spin_lock(spinlock_t *lock) |
354 |
+ |
{ |
355 |
+ |
} |
356 |
+ |
|
357 |
+ |
static inline void spin_unlock(spinlock_t *lock) |
358 |
+ |
{ |
359 |
+ |
} |
360 |
+ |
|
361 |
+ |
static inline int spin_trylock(spinlock_t *lock) |
362 |
+ |
{ |
363 |
+ |
return 1; |
364 |
+ |
} |
365 |
|
#endif |
366 |
|
|
367 |
|
// Time data type for Time Manager emulation |