Add initializers
This commit is contained in:
@@ -41,6 +41,10 @@ static inline uint8_t priority_of(struct task* task) {
|
||||
return atomic_load(&task->priority, ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
void rwlock_init(struct rwlock* rw) {
|
||||
atomic_store(&rw->word, 0, ATOMIC_RELAXED);
|
||||
}
|
||||
|
||||
bool rwlock_try_read_lock(struct rwlock* rw) {
|
||||
uintptr_t word = atomic_load(&rw->word, ATOMIC_RELAXED);
|
||||
while (!(word & (RW_WRITE_LOCK | RW_WRITE_WANT))) {
|
||||
|
||||
Reference in New Issue
Block a user