#include <chrono>
using namespace std;
using namespace std::chrono_literals;
struct quit {};
{
int x = 0, y = 1;
do
{
r = select(
from_all().handle_n(1),
[&x, &y] {
auto old_x = x;
x = y; y = old_x + y;
} ),
}
}
int main()
{
thread fibonacci_thr;
auto thr_joiner =
auto_join( fibonacci_thr );
mchain_props::memory_usage_t::preallocated,
mchain_props::overflow_reaction_t::abort_app );
fibonacci_thr = thread{ fibonacci, values_ch, quit_ch };
[]( int v ) { cout << v << endl; } );
send< quit >( quit_ch );
}
A helper header file for including all public SObjectizer stuff.
A result of select from several mchains.
bool was_sent() const noexcept
bool was_handled() const noexcept
A class for holding an instance of a message.
Private part of message limit implementation.
thread_auto_join_details::auto_joiner_t< 1+sizeof...(Tail) > auto_join(std::thread &first_thread, Tail &&... tail)
Helper function for creation of automatic joiner of std::threads.
mchain_receive_params_t< mchain_props::msg_count_status_t::undefined > from(mchain_t chain)
A helper function for simplification of creation of mchain_receive_params instance.
mchain_auto_close_details::auto_closer_t< sizeof...(Tail) > auto_close_drop_content(Tail &&... tail)
Helper function for automatic closing of mchains with dropping their content.
mchain_t create_mchain(environment_t &env)
Create size-unlimited chain.
mchain_props::select_case_unique_ptr_t receive_case(mchain_t chain, Handlers &&... handlers)
A helper for creation of select_case object for one multi chain select.
mchain_receive_result_t receive(const mchain_receive_params_t< Msg_Count_Status > ¶ms, Handlers &&... handlers)
Advanced version of receive from mchain.