coro.h

来自「Fax and soft modem source code. - Slow m」· C头文件 代码 · 共 27 行

H
27
字号
//Lorcan. no coro.h file found with this package. Found this at http://www.goron.de/~froese/coro/coro-1.1.0.pre2.tar.gz
#ifndef CORO_H
#define CORO_H

struct coroutine
{
    void *sp;			/* saved stack pointer while coro is inactive */
    struct coroutine *caller;	/* PUBLIC who has called this coroutine */
    struct coroutine *resumeto;	/* PUBLIC who to resume to */
    void *user;			/* PUBLIC user data.  for whatever you want. */

    void *(*func)(void *);	/* coroutines main function */
    int to_free;		/* how much memory to free on co_delete */
};

extern struct coroutine *co_current;	/* currently active coroutine */
extern struct coroutine co_main[];	/* automagically generated main coro. */

struct coroutine *co_create(void *func, void *stack, int stacksize);
void *co_call(struct coroutine *co, void *data);
void *co_resume(void *data);
void co_delete(struct coroutine *co);
void co_exit_to(struct coroutine *co, void *data) __attribute__((noreturn));
void co_exit(void *data) __attribute__((noreturn));

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?