forked from apache/nuttx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
spinlock: implement read writer spinlock
spinlock.c: Implement read write spinlock. Readers can take lock simultaneously but only one writer can take lock. irq_spinlock.c: Align g_irq_spin_count. If the lock is NULL, the caller will get global lock (e.g. g_irq_spin) and spin_lock_irqsave() support nest on the same CPU. If the CPU can write lock, it can call write_lock_irqsave() again (e.g. support nest). Why is the variable called g_irq_write_spin_count? Because reader can read data simultaneously and the counter is already record in lock. So we only need to record the counter of the cpu take the write lock (nest). Signed-off-by: TaiJu Wu <[email protected]>
- Loading branch information
Showing
4 changed files
with
753 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.