mirror of
https://github.com/janet-lang/janet
synced 2026-08-15 23:08:53 +00:00
Work on moving to mailbox abstraction.
Should be more efficient in the common case.
This commit is contained in:
+3
-18
@@ -944,26 +944,11 @@ struct JanetRNG {
|
||||
|
||||
/* Thread types */
|
||||
#ifdef JANET_THREADS
|
||||
#include <pthread.h>
|
||||
typedef struct JanetThread JanetThread;
|
||||
typedef struct JanetChannel JanetChannel;
|
||||
typedef struct JanetThreadSelector JanetThreadSelector;
|
||||
struct JanetThreadSelector {
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t cond;
|
||||
JanetChannel *channel;
|
||||
};
|
||||
struct JanetChannel {
|
||||
pthread_mutex_t lock;
|
||||
JanetBuffer buf;
|
||||
int refCount;
|
||||
JanetThreadSelector *selector;
|
||||
JanetTable *encode; /* only touched by writers */
|
||||
JanetTable *decode; /* only touched by readers */
|
||||
};
|
||||
typedef struct JanetMailbox JanetMailbox;
|
||||
struct JanetThread {
|
||||
JanetChannel *rx;
|
||||
JanetChannel *tx;
|
||||
JanetMailbox *mailbox;
|
||||
JanetTable *encode;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user