示例#1
0
static void
mainfunc(uint32_t low32, uint32_t hi32) {
	uintptr_t ptr = (uintptr_t)low32 | ((uintptr_t)hi32 << 32);
	struct schedule *sched = (struct schedule *)ptr;
	int id = sched->running;
    struct coroutine *C = sched->co[id];
    C->callbacks.main_(sched,C->callbacks.ud_);
    coroutine_delete(sched, id);
	sched->running = -1;
}
示例#2
0
static void
_run(struct coroutine *co) {
    _set_running_coroutine(co);
    _resume(co);
    _set_running_coroutine(NULL);
    if (co->status == STATUS_EXITING) {
        coroutine_delete(co);
        return;
    }
    _save_stack(co);
}