| UbixOS
    2.0
    | 

Go to the source code of this file.
| Macros | |
| #define | atomic_add(P, V) __sync_add_and_fetch((P), (V)) | 
| #define | atomic_clear_bit(P, V) __sync_and_and_fetch((P), ~(1<<(V))) | 
| #define | atomic_dec(P) __sync_add_and_fetch((P), -1) | 
| #define | atomic_inc(P) __sync_add_and_fetch((P), 1) | 
| #define | atomic_set_bit(P, V) __sync_or_and_fetch((P), 1<<(V)) | 
| #define | atomic_xadd(P, V) __sync_fetch_and_add((P), (V)) | 
| #define | barrier() asm volatile("": : :"memory") | 
| #define | cmpxchg(P, O, N) __sync_val_compare_and_swap((P), (O), (N)) | 
| #define | cpu_relax() asm volatile("pause\n": : :"memory") | 
| Functions | |
| void | spinLock (spinLock_t lock) | 
| void | spinLockInit (spinLock_t lock) | 
| int | spinTryLock (spinLock_t lock) | 
| void | spinUnlock (spinLock_t lock) | 
| #define atomic_add | ( | P, | |
| V | |||
| ) | __sync_add_and_fetch((P), (V)) | 
Definition at line 38 of file spinlock.c.
| #define atomic_clear_bit | ( | P, | |
| V | |||
| ) | __sync_and_and_fetch((P), ~(1<<(V))) | 
Definition at line 40 of file spinlock.c.
| #define atomic_dec | ( | P | ) | __sync_add_and_fetch((P), -1) | 
Definition at line 37 of file spinlock.c.
| #define atomic_inc | ( | P | ) | __sync_add_and_fetch((P), 1) | 
Definition at line 36 of file spinlock.c.
| #define atomic_set_bit | ( | P, | |
| V | |||
| ) | __sync_or_and_fetch((P), 1<<(V)) | 
Definition at line 39 of file spinlock.c.
| #define atomic_xadd | ( | P, | |
| V | |||
| ) | __sync_fetch_and_add((P), (V)) | 
Definition at line 34 of file spinlock.c.
Definition at line 42 of file spinlock.c.
| #define cmpxchg | ( | P, | |
| O, | |||
| N | |||
| ) | __sync_val_compare_and_swap((P), (O), (N)) | 
Definition at line 35 of file spinlock.c.
Definition at line 45 of file spinlock.c.
| void spinLock | ( | spinLock_t | lock | ) | 
Definition at line 64 of file spinlock.c.
| void spinLockInit | ( | spinLock_t | lock | ) | 
Definition at line 47 of file spinlock.c.
References memset().

| int spinTryLock | ( | spinLock_t | lock | ) | 
Definition at line 51 of file spinlock.c.
References cmpxchg, LLOCK_FLAG, LOCKED, spinLock::locked, and NULL.
| void spinUnlock | ( | spinLock_t | lock | ) | 
Definition at line 59 of file spinlock.c.
References barrier, and spinLock::locked.