1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-29 03:19:54 +00:00

Expose current fiber via janet_current_fiber().

This commit is contained in:
Calvin Rose 2019-05-04 19:07:04 -04:00
parent 5a28d8d1fa
commit ff720f1320
2 changed files with 5 additions and 0 deletions

View File

@ -296,6 +296,10 @@ JanetFiberStatus janet_fiber_status(JanetFiber *f) {
return ((f)->flags & JANET_FIBER_STATUS_MASK) >> JANET_FIBER_STATUS_OFFSET;
}
JanetFiber *janet_current_fiber(void) {
return janet_vm_fiber;
}
/* CFuns */
static Janet cfun_fiber_getenv(int32_t argc, Janet *argv) {

View File

@ -1174,6 +1174,7 @@ JANET_API JanetKV *janet_table_find(JanetTable *t, Janet key);
JANET_API JanetFiber *janet_fiber(JanetFunction *callee, int32_t capacity, int32_t argc, const Janet *argv);
JANET_API JanetFiber *janet_fiber_reset(JanetFiber *fiber, JanetFunction *callee, int32_t argc, const Janet *argv);
JANET_API JanetFiberStatus janet_fiber_status(JanetFiber *fiber);
JANET_API JanetFiber *janet_current_fiber(void);
/* Treat similar types through uniform interfaces for iteration */
JANET_API int janet_indexed_view(Janet seq, const Janet **data, int32_t *len);