声明一个第三方的execution context,然后从中获取scheduler。在这里execution context指的是第三方库libunifex提供的static_thread_pool线程池 通过schedule()创建空的任务单元。这意味着任务将运行在static_thread_pool的上下文中 schedule()返回一个sender,可以接着调用then()算法。此前的空任务会切换执行某种任务比如com...
#include <stdexec/execution.hpp> #include <exec/static_thread_pool.hpp> int main() { // Declare a pool of 3 worker threads: exec::static_thread_pool pool(3); // Get a handle to the thread pool: auto sched = pool.get_scheduler(); // Describe some work: // Creates 3 sender ...