From a125218d034b02dc0948603f5ac2e36553386e1f Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Tue, 20 Jul 2021 18:24:56 -0500 Subject: [PATCH] Move some defines. --- src/core/ev.c | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/src/core/ev.c b/src/core/ev.c index e5da6ed3..6dfbc77e 100644 --- a/src/core/ev.c +++ b/src/core/ev.c @@ -72,6 +72,28 @@ typedef struct { int32_t limit; } JanetChannel; +typedef struct { + JanetFiber *fiber; + Janet value; + JanetSignal sig; +} JanetTask; + +/* Wrap return value by pairing it with the callback used to handle it + * in the main thread */ +typedef struct { + JanetEVGenericMessage msg; + JanetThreadedCallback cb; +} JanetSelfPipeEvent; + +/* Structure used to initialize threads in the thread pool + * (same head structure as self pipe event)*/ +typedef struct { + JanetEVGenericMessage msg; + JanetThreadedCallback cb; + JanetThreadedSubroutine subr; + JanetHandle write_pipe; +} JanetEVThreadInit; + #define JANET_MAX_Q_CAPACITY 0x7FFFFFF static void janet_q_init(JanetQueue *q) { @@ -127,14 +149,6 @@ static int janet_q_pop(JanetQueue *q, void *out, size_t itemsize) { return 0; } -/* New fibers to spawn or resume */ -typedef struct JanetTask JanetTask; -struct JanetTask { - JanetFiber *fiber; - Janet value; - JanetSignal sig; -}; - /* Forward declaration */ static void janet_unlisten(JanetListenerState *state); @@ -905,22 +919,6 @@ void janet_loop(void) { * Self-pipe handling code. */ -/* Wrap return value by pairing it with the callback used to handle it - * in the main thread */ -typedef struct { - JanetEVGenericMessage msg; - JanetThreadedCallback cb; -} JanetSelfPipeEvent; - -/* Structure used to initialize threads in the thread pool - * (same head structure as self pipe event)*/ -typedef struct { - JanetEVGenericMessage msg; - JanetThreadedCallback cb; - JanetThreadedSubroutine subr; - JanetHandle write_pipe; -} JanetEVThreadInit; - #ifdef JANET_WINDOWS /* On windows, use PostQueuedCompletionStatus instead for