Init Repo

This commit is contained in:
root
2019-09-06 23:53:10 +08:00
commit f0ef89dfbb
7905 changed files with 914138 additions and 0 deletions

42
vendor/swoole/include/coroutine.h vendored Executable file
View File

@ -0,0 +1,42 @@
#ifndef SW_COROUTINE_H_
#define SW_COROUTINE_H_
#include "swoole.h"
#ifdef __cplusplus
extern "C"
{
#endif
void coro_yield();
void coro_handle_timeout();
#define DEFAULT_MAX_CORO_NUM 3000
#define DEFAULT_STACK_SIZE 8192
#define MAX_CORO_NUM_LIMIT 0x80000
#define CORO_END 0
#define CORO_YIELD 1
#define CORO_LIMIT -1
#define CORO_SAVE 3
typedef struct coroutine_s coroutine_t;
typedef void (*coroutine_func_t)(void*);
typedef void (*coroutine_close_t)();
typedef enum
{
SW_CORO_YIELD = 0, SW_CORO_SUSPENDED, SW_CORO_RUNNING, SW_CORO_END,
} sw_coro_state;
int coroutine_create(coroutine_func_t func, void* args);
void coroutine_resume(coroutine_t *co);
void coroutine_yield(coroutine_t *co);
void coroutine_release(coroutine_t *co);
coroutine_t *coroutine_get_by_id(int cid);
int coroutine_get_cid();
void coroutine_set_close(coroutine_close_t func);
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif