void Coro_startCoro_(Coro *self, Coro *other, void *context, CoroStartCallback *callback) { globalCallbackBlock.context = context; globalCallbackBlock.func = callback; Coro_allocStackIfNeeded(other); Coro_setup(other, &globalCallbackBlock); Coro_switchTo_(self, other); }
void Coro_startCoro_(Coro *self, Coro *other, void *context, CoroStartCallback *callback) { CallbackBlock sblock; CallbackBlock *block = &sblock; //CallbackBlock *block = malloc(sizeof(CallbackBlock)); // memory leak block->context = context; block->func = callback; Coro_allocStackIfNeeded(other); Coro_setup(other, block); Coro_switchTo_(self, other); }
void Coro_startCoro_(Coro *self, Coro *other, void *context, CoroStartCallback *callback) { CallbackBlock sblock; CallbackBlock *block = &sblock; //CallbackBlock *block = malloc(sizeof(CallbackBlock)); // memory leak block->context = context; block->func = callback; #ifdef USE_FIBERS block->associatedCoro = other; #else Coro_allocStackIfNeeded(other); #endif Coro_setup(other, block); Coro_switchTo_(self, other); }