mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
kernel: finish work of removing interruptible mutexes
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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; \
|
||||
|
||||
@@ -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(); \
|
||||
} \
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user