|
Click
|
A spinlock that disables interrupts. More...
#include <sync.hh>
Public Types | |
| typedef unsigned long | flags_t |
Public Member Functions | |
| SpinlockIRQ () | |
| Creates a SpinlockIRQ. | |
| flags_t | acquire () CLICK_ALWAYS_INLINE |
| Acquires the SpinlockIRQ. | |
| void | release (flags_t) CLICK_ALWAYS_INLINE |
| Releases the SpinlockIRQ. | |
A spinlock that disables interrupts.
The SpinlockIRQ class abstracts a spinlock, or polling mutex, that also turns off interrupts. Spinlocks are a type of mutual-exclusion lock in which acquiring the lock is a polling operation (basically a "while (lock.acquired()) do nothing;" loop). The SpinlockIRQ variant can be used to protect Click data structures from interrupts and from other threads. Very few objects in Click need this protection; the Click Master object, which protects the task list, uses it, but that's hidden from users. Spinlocks should not be held for long periods of time: use them for quick updates and such.
In the Linux kernel, SpinlockIRQ is equivalent to a combination of local_irq_save and the spinlock_t type.
The SpinlockIRQ operations are acquire(), which acquires the lock, and release(), which releases the lock.
It is NOT OK for a SpinlockIRQ thread to acquire a lock it has already acquired.
|
inline |
Creates a SpinlockIRQ.
|
inline |
Acquires the SpinlockIRQ.
|
inline |
Releases the SpinlockIRQ.
| flags | The value returned by SpinlockIRQ::acquire(). |