324 |
|
|
325 |
#define SPIN_LOCK_UNLOCKED 0 |
#define SPIN_LOCK_UNLOCKED 0 |
326 |
|
|
327 |
|
#if 1 |
328 |
static inline void spin_lock(spinlock_t *lock) |
static inline void spin_lock(spinlock_t *lock) |
329 |
{ |
{ |
330 |
while (testandset(lock)); |
while (testandset(lock)); |
339 |
{ |
{ |
340 |
return !testandset(lock); |
return !testandset(lock); |
341 |
} |
} |
342 |
|
#else |
343 |
|
static inline void spin_lock(spinlock_t *lock) |
344 |
|
{ |
345 |
|
} |
346 |
|
|
347 |
|
static inline void spin_unlock(spinlock_t *lock) |
348 |
|
{ |
349 |
|
} |
350 |
|
|
351 |
|
static inline int spin_trylock(spinlock_t *lock) |
352 |
|
{ |
353 |
|
return 1; |
354 |
|
} |
355 |
|
#endif |
356 |
|
|
357 |
extern spinlock_t tb_lock; |
extern spinlock_t tb_lock; |
358 |
|
|