mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-02 07:28:21 +00:00
futex: statically define table and mutex
This commit is contained in:
@@ -7,9 +7,8 @@
|
|||||||
#include <kernel/alloc.h>
|
#include <kernel/alloc.h>
|
||||||
#include <arch/cpu.h>
|
#include <arch/cpu.h>
|
||||||
|
|
||||||
static mutex_t futexmutex;
|
static MUTEX_DEFINE(futexmutex);
|
||||||
static hashtable_t hashtable;
|
HASHTABLE_DEFINE_STATIC(hashtable, 256);
|
||||||
static bool hashtableinit;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
pollheader_t pollheader;
|
pollheader_t pollheader;
|
||||||
@@ -46,16 +45,6 @@ syscallret_t syscall_futex(context_t *, uint32_t *futexp, int op, uint32_t value
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(hashtableinit == false)) {
|
|
||||||
if (unlikely(hashtable_init(&hashtable, 256))) {
|
|
||||||
ret.errno = ENOMEM;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
hashtableinit = true;
|
|
||||||
MUTEX_INIT(&futexmutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
timespec_t timespec = {0};
|
timespec_t timespec = {0};
|
||||||
if (tm) {
|
if (tm) {
|
||||||
ret.errno = usercopy_fromuser(×pec, tm, sizeof(timespec_t));
|
ret.errno = usercopy_fromuser(×pec, tm, sizeof(timespec_t));
|
||||||
|
|||||||
Reference in New Issue
Block a user