19 lines
392 B
C
19 lines
392 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#ifndef _RWLOCK_H_
|
|
#define _RWLOCK_H_
|
|
|
|
#include <lib/sem.h>
|
|
|
|
typedef struct _rwlock {
|
|
sem_t sem;
|
|
spinlock_t reader_lock;
|
|
u64 reader_count;
|
|
} rwlock_t;
|
|
|
|
void read_lock(rwlock_t *lock);
|
|
void read_unlock(rwlock_t *lock);
|
|
void write_lock(rwlock_t *lock);
|
|
void write_unlock(rwlock_t *lock);
|
|
void rwlock_init(rwlock_t *lock);
|
|
|
|
#endif /* _RWLOCK_H_ */
|