Initial commit
This commit is contained in:
commit
ef80f65fbf
136 changed files with 13728 additions and 0 deletions
23
include/lock.h
Normal file
23
include/lock.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include <error.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifndef SPINLOCK_H
|
||||
#define SPINLOCK_H
|
||||
|
||||
struct mutex {
|
||||
atomic_flag lock;
|
||||
bool locked;
|
||||
struct thread *holder;
|
||||
};
|
||||
|
||||
void acquire_spinlock(atomic_flag *lock);
|
||||
void free_spinlock(atomic_flag *lock);
|
||||
|
||||
struct mutex *init_mutex();
|
||||
kstatus acquire_mutex(struct mutex *mut);
|
||||
void free_mutex(struct mutex *mut);
|
||||
kstatus try_mutex(struct mutex *mut);
|
||||
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue