【文件属性】:
文件名称:cogo:无栈CC ++协程库
文件大小:15KB
文件格式:ZIP
更新时间:2021-04-12 08:12:01
C
介绍
C的无堆栈协程库,实现了yield,await,并发和通道。
概述
# include " cogo.h "
co_declare (CoroutineName, T var, ...)
{
co_begin:
//
// user code
//
co_end:;
}
例子
自然数发生器
# include " cogo.h "
# include < stdio>
co_declare (Nat, int value)
{
co_begin:
for (co_this-> value = 0 ; ; co_this-> value ++) {
co_yield;
}
co_end:;
}
int main ()
{
Nat n = co_make (Nat);
CO_STEP (&n);
pri
【文件预览】:
cogo-master
----yield_case.h(3KB)
----co_fs.c(414B)
----co_test.cpp(4KB)
----cogo.h(613B)
----yield_test.cpp(2KB)
----yield_label_value.h(3KB)
----queue_fs.inc(2KB)
----CMakeLists.txt(2KB)
----README.org(8KB)
----co.h(4KB)
----LICENSE(1KB)
----co_fs_test.cpp(746B)
----yield.h(3KB)
----utils.h(6KB)
----co_fs.h(6KB)