diff options
| author | 2021-08-19 20:56:48 -0500 | |
|---|---|---|
| committer | 2021-08-19 20:56:48 -0500 | |
| commit | eb0b37f7296611a411b9a86d9d65fe620b0454d8 (patch) | |
| tree | 399601210797c2a46df20e59c5d033eae46744e3 /src/include/janet.h | |
| parent | Fix threaded supervisor channels - Fix #766 (diff) | |
Initial threaded abstract types.
Diffstat (limited to 'src/include/janet.h')
| -rw-r--r-- | src/include/janet.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/include/janet.h b/src/include/janet.h index b7f5c2b8..4027b672 100644 --- a/src/include/janet.h +++ b/src/include/janet.h @@ -839,7 +839,10 @@ JANET_API JanetAbstract janet_checkabstract(Janet x, const JanetAbstractType *at * list of blocks, which is naive but works. */ struct JanetGCObject { int32_t flags; - JanetGCObject *next; + union { + JanetGCObject *next; + int32_t refcount; /* For threaded abstract types */ + }; }; /* A lightweight green thread in janet. Does not correspond to @@ -1344,6 +1347,13 @@ JANET_API void janet_addtimeout(double sec); JANET_API void janet_ev_inc_refcount(void); JANET_API void janet_ev_dec_refcount(void); +/* Thread aware abstract types and helpers */ +JANET_API void *janet_abstract_begin_threaded(const JanetAbstractType *atype, size_t size); +JANET_API void *janet_abstract_end_threaded(void *x); +JANET_API void *janet_abstract_threaded(const JanetAbstractType *atype, size_t size); +JANET_API int32_t janet_abstract_incref(void *abst); +JANET_API int32_t janet_abstract_decref(void *abst); + /* Get last error from an IO operation */ JANET_API Janet janet_ev_lasterr(void); |
