Move some defines.

This commit is contained in:
Calvin Rose 2021-07-20 18:24:56 -05:00
parent 55b8563c08
commit a125218d03
1 changed files with 22 additions and 24 deletions

View File

@ -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