34 if (pendingRequests.size() == maxOutstanding || toSend == 0) {
35 if (pendingRequests.empty()) {
38 intptr_t
value = rand() % 1000;
39 std::cout <<
"Completing request with data = " << value << std::endl;
41 pendingRequests.front().setValue(value);
42 pendingRequests.pop();
44 static size_t id_counter = 1;
45 size_t id = id_counter++;
46 std::cout <<
"Adding new request with id = " <<
id << std::endl;
48 fiberManager.addTask([
this,
id]() {
49 std::cout <<
"Executing fiber with id = " <<
id << std::endl;
55 std::cout <<
"Fiber id = " <<
id <<
" got result1 = " << result1
61 std::cout <<
"Fiber id = " <<
id <<
" got result2 = " << result2
66 auto& loopController =
68 loopController.
stop();
83 auto loop = [&app]() { app.
loop(); };
85 auto& loopController =
FiberManager fiberManager
constexpr detail::Map< Move > move
Single-threaded task execution engine.
std::queue< Promise< int > > pendingRequests
LoopController & loopController()
std::enable_if<!std::is_array< T >::value, std::unique_ptr< T > >::type make_unique(Args &&...args)
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
FirstArgOf< F >::type::value_type await(F &&func)