kernel: finish work of removing interruptible mutexes

This commit is contained in:
Matheus
2024-12-24 21:30:25 -03:00
parent 48643c4868
commit a6c169e5e6
42 changed files with 169 additions and 169 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ int fd_setflags(int fd, int flags);
int fd_getflags(int fd, int *flags);
int fd_insert(file_t *file, int *fdp);
#define FILE_LOCK(x) MUTEX_ACQUIRE(&(x)->mutex, false)
#define FILE_LOCK(x) MUTEX_ACQUIRE(&(x)->mutex)
#define FILE_UNLOCK(x) MUTEX_RELEASE(&(x)->mutex)
#define FILE_READ 1
+1 -1
View File
@@ -86,7 +86,7 @@ typedef struct proc_t {
// the acquire of the pid table mutex is done here to prevent a nasty race condition where sched_inactiveproc could be called multiple times
// due to the pid table itself not holding any references to the process
#define PROC_RELEASE(v) {\
MUTEX_ACQUIRE(&proc_pid_table_mutex, false); \
MUTEX_ACQUIRE(&proc_pid_table_mutex); \
if (__atomic_sub_fetch(&(v)->refcount, 1, __ATOMIC_SEQ_CST) == 0) {\
proc_inactive(v); \
(v) = NULL; \
+1 -1
View File
@@ -18,7 +18,7 @@ extern mutex_t printf_mutex;
#define printf(...) { \
if (likely(current_thread())) {\
MUTEX_ACQUIRE(&printf_mutex, false); \
MUTEX_ACQUIRE(&printf_mutex); \
} else { \
while (MUTEX_TRY(&printf_mutex) == false) CPU_PAUSE(); \
} \
+4 -4
View File
@@ -8,11 +8,11 @@ typedef semaphore_t mutex_t;
#define MUTEX_INIT(m) \
SEMAPHORE_INIT(m, 1);
#define MUTEX_ACQUIRE(m, i) \
semaphore_wait(m, i)
#define MUTEX_ACQUIRE(m) \
semaphore_wait(m, false)
#define MUTEX_ACQUIRE_TIMED(m, t, i) \
semaphore_timedwait(m, t, i)
#define MUTEX_ACQUIRE_TIMED(m, t) \
semaphore_timedwait(m, t, false)
#define MUTEX_RELEASE(m) \
semaphore_signal(m)