|
KallistiOS
##version##
|
Simple locking. More...
Go to the source code of this file.
Macros | |
| #define | SPINLOCK_INITIALIZER 0 |
| Spinlock initializer. More... | |
| #define | spinlock_init(A) *(A) = SPINLOCK_INITIALIZER |
| Initialize a spinlock. More... | |
| #define | spinlock_lock(A) |
| Spin on a lock. More... | |
| #define | spinlock_unlock(A) |
| Free a lock. More... | |
| #define | spinlock_is_locked(A) ( *(A) != 0 ) |
| Determine if a lock is locked. More... | |
Typedefs | |
| typedef volatile int | spinlock_t |
| Spinlock data type. More... | |
Simple locking.
This file contains definitions for very simple locks. Most of the time, you will probably not use such low-level locking, but will opt for something more fully featured like mutexes, semaphores, reader-writer semaphores, or recursive locks.
| #define spinlock_init | ( | A | ) | *(A) = SPINLOCK_INITIALIZER |
Initialize a spinlock.
This function-like macro abstracts initializing a spinlock, in case the initializer is not applicable to what you are doing.
| A | A pointer to the spinlock to be initialized. |
| #define SPINLOCK_INITIALIZER 0 |
Spinlock initializer.
All created spinlocks should be initialized with this initializer so that they are in a sane state, ready to be used.
| #define spinlock_is_locked | ( | A | ) | ( *(A) != 0 ) |
Determine if a lock is locked.
This macro will return whether or not the lock specified is actually locked when it is called. This is NOT a thread-safe way of determining if a lock will be locked when you get around to locking it!
| A | A pointer to the spinlock to be checked. |
| #define spinlock_lock | ( | A | ) |
Spin on a lock.
This macro will spin on the lock, and will not return until the lock has been obtained for the calling thread.
| A | A pointer to the spinlock to be locked. |
| #define spinlock_unlock | ( | A | ) |
Free a lock.
This macro will unlock the lock that is currently held by the calling thread. Do not use this macro unless you actually hold the lock!
| A | A pointer to the spinlock to be unlocked. |
| typedef volatile int spinlock_t |
Spinlock data type.
1.8.7