diff options
Diffstat (limited to 'src/coro.c')
-rw-r--r-- | src/coro.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -1,11 +1,20 @@ #include <u.h> // ----------------------------------------------------------------------- -// Assembly routines. +// Assembly routines extern void _newcoro(coro *co, uintptr (*func)(coro*, uintptr), void *stk); extern uintptr _coroyield(coro *co, uintptr arg); +// ----------------------------------------------------------------------- +// Globals + +// static thread_local coro *CONTEXT; + +// ----------------------------------------------------------------------- +// C interface + +/* Co-routine context */ struct coro { void* sp; @@ -17,9 +26,7 @@ struct coro coro* coro·new(uintptr stk, uintptr (*func)(coro*, uintptr)) { - if (!func) - return nil; - + if (!func) return nil; if (stk == 0) stk = 8192; byte *block = malloc(stk); |