20 lines
408 B
C
20 lines
408 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#ifndef _RWLOCK_H_
|
|
#define _RWLOCK_H_
|
|
|
|
#include <kernel/spinlock.h>
|
|
#include <kernel/types.h>
|
|
|
|
typedef struct {
|
|
spinlock_t lock;
|
|
u64 readers;
|
|
bool writer;
|
|
} 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_ */
|