|
solidc
Robust collection of general-purpose cross-platform C libraries and data structures designed for rapid and safe development in C
|
High-performance reader-writer spinlock implementation. More...
#include <stdatomic.h>Go to the source code of this file.
Classes | |
| struct | fast_rwlock_t |
| Reader-writer spinlock structure. More... | |
High-performance reader-writer spinlock implementation.
This header provides a custom RW-spinlock optimized for short critical sections and high-concurrency scenarios. It significantly outperforms pthread_rwlock_t when lock hold times are very brief (microseconds) due to lower overhead.
The spinlock uses a single atomic integer to track state:
For longer critical sections or high contention, use pthread_rwlock_t instead.
Definition in file spinlock.h.