ReactivePlusPlus
ReactiveX implementation for C++20
Loading...
Searching...
No Matches
rpp::schedulers::computational Class Referencefinal

Scheduler owning static thread pool of workers and using "some" thread from this pool on create_worker call. More...

#include <computational.hpp>

Static Public Member Functions

static auto create_worker ()
 

Detailed Description

Scheduler owning static thread pool of workers and using "some" thread from this pool on create_worker call.

Warning
Actually it is static variable to thread_pool scheduler
Note
Expected to pass to this scheduler intensive CPU bound tasks with relatevely small duration of execution (to be sure that no any thread with tasks from some other operators would be blocked on that task)
Examples
rpp::source::just(1, 2, 3, 4, 5, 6, 7, 8)
| rpp::operators::delay(std::chrono::nanoseconds{500}, rpp::schedulers::immediate{}); })
| rpp::operators::subscribe([](int v) { std::cout << "[" << std::this_thread::get_id() << "] " << v << std::endl; });
// Output: (can be in any order but same correlation between thread and values)
// [thread_1] 1
// [thread_2] 2
// [thread_3] 3
// [thread_4] 4
// [thread_1] 5
// [thread_2] 6
// [thread_3] 7
// [thread_4] 8
Examples
thread_pool.cpp.

The documentation for this class was generated from the following file: