1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-04 17:43:02 +00:00

Simplify structure JanetThread and JanetChannel.

Remove JanetThreadShared.
This commit is contained in:
Calvin Rose
2019-12-04 21:04:43 -06:00
parent a1f35e21c7
commit de6c3d6d70
3 changed files with 76 additions and 95 deletions

View File

@@ -942,27 +942,18 @@ struct JanetRNG {
#ifdef JANET_THREADS
#include <pthread.h>
typedef struct JanetThread JanetThread;
typedef struct JanetThreadShared JanetThreadShared;
typedef struct JanetChannel JanetChannel;
struct JanetChannel {
pthread_mutex_t lock;
pthread_cond_t cond;
JanetBuffer buf;
};
struct JanetThreadShared {
pthread_mutex_t refCountLock;
int refCount;
JanetChannel parent;
JanetChannel child;
};
struct JanetThread {
JanetThreadShared *shared;
JanetChannel *rx;
JanetChannel *tx;
JanetTable *encode;
JanetTable *decode;
enum {
JANET_THREAD_SELF,
JANET_THREAD_OTHER
} kind;
};
#endif