coroutine
coroutine copied to clipboard
A asymmetric coroutine library for C.
This is windows implementation for coroutine, fully tested. ``` d:\coroutine\build>debug\demo.exe main start coroutine 1 : 0 coroutine 2 : 100 coroutine 1 : 1 coroutine 2 : 101 coroutine 1...
Mac OS 10.14.7版本。 gcc info: Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple LLVM version 10.0.1 (clang-1001.0.46.4) Target: x86_64-apple-darwin18.2.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin 在这个版本上编译,并运行代码生成的main 以后程序报告: Assertion failed: (0), function coroutine_resume, file coroutine.c,...
公用栈支持分组?
比如一个 schedule 里面有 100个 stack,每个 2MB,一共 200MB,每个栈,管理一组 coroutine 假设有 5000个 coroutine ,平均分布在 100组栈上,每组栈 50个 coroutine。 coroutine 被切走的时候,并不会马上拷贝栈,而会保留在那一个栈上,直到同一组的 coroutine 需要resume,才会把之前 on-stack 的 coroutine 拷贝走。 这样每个 stack 上保留的 coroutine 都是最近最活跃的 coroutine,栈拷贝的次数下降100倍。
_save_stack函数中dummy变量定义在coroutine_yield是不是更好? ```bash static void _save_stack(struct coroutine *C, char *top, char *bottom) { //top:stack bottom:sp assert(top - bottom cap < top - bottom) { free(C->stack); C->cap = top-bottom; C->stack = malloc(C->cap);...
使用QtCreator编辑安卓项目 安卓平台支持ucontext_t,但是不支持setcontext, swapcontext等函数,有没有什么办法在安卓平台上使用本库?
#define _XOPEN_SOURCE #if __APPLE__ && __MACH__ #include #else #include #endif 在mac上 加上这个才能编译 运行成功
This PR fixes an issue in the Makefile. Specifically, previously, any modifications of files like coroutine.h would not trigger a rebuild of main. The PR fixes this by including them...