tearshark / librf Goto Github PK
View Code? Open in Web Editor NEW基于C++ Coroutines编写的无栈协程库
License: Apache License 2.0
基于C++ Coroutines编写的无栈协程库
License: Apache License 2.0
我在mac 系统下, 11.5.2, xcode 12.5.1
cmake -G Xcode 生成的工程无法编译
用 cmake build && make也编译不了
请问正确的编译方法是什么呢?
我想尝试在iOS上使用这个库
“创建100万个协程只需使用<820M>物理内存”
这个应该看使用的局部变量消耗的空间的大小?还是说除开了局部变量在堆上的”持久化保存“,其他的所有消耗在820M 左右?
比如:有
xxx f1() {
...
f2(); // 调用f2后可能会suspend
// 同步代码
.....
.....
}
xxx f2(){
co_await event.wait_for(1000ms); // 没有signal时suspend
}
LIBRF_API bool scheduler_t::run_one_batch()
{
this->_timer->update();
{
#if !RESUMEF_DISABLE_MULT_THREAD
scoped_lock __guard(_lock_running);
#endif
if (likely(_runing_states.empty()))
return false;
std::swap(_cached_states, _runing_states);
}
for (state_sptr& sptr : _cached_states)
sptr->resume();
_cached_states.clear();
return true;
}
使用clang11.0 编译出现如下的错误(clang10 无此编译错误) ,使用了gcc10.2 的libstdc++
In file included from /home/xxx/prog/librf/librf/librf.h:82:
In file included from /home/xxx/prog/librf/librf/src/mutex.h:5:
/home/xxx/prog/librf/librf/src/mutex_v2.inl:476:15: error: the expression 'co_await __promise.final_suspend()' is required to be non-throwing
future_t<> _Yield() const
^
/data/software/gcc-10.2.0/lib/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/coroutine:205:5: note: must be declared with 'noexcept'
}
作者你好,我在代码注释里面看到 _coro 对象可能来自协程里的promise产生的, 也可能来自 也可能来自awaitable_t,这两种情况分别对应什么场景,能否举个例子, future_await_suspend 对这两种场景是否需要区别处理
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.