You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
622 B
C

#include "mutex.h"
#include "../kernel.h"
// mutex lock structure:
// this is a dict describing which process instantiated the lock
// it maps mutex_id -> pid (or zero for unused locks)
int locks[MUTEX_COUNT];
int locks_bitfield[MUTEX_COUNT / XLEN]; // each bit representing if the lock is
// engaged
int mutex_is_locked(int mutex_id)
{
int offset = mutex_id % XLEN;
return locks[mutex_id / XLEN] & (1 << offset);
}
int mutex_create()
{
return 0;
}
void mutex_lock(int mutex_id)
{
}
void mutex_unlock(int mutex_id)
{
}
void mutex_destroy(int mutex_id)
{
}