implements the cpp-async library focusing on concurrent call communication architecture
to build a library with minial installation setup & also ease to modify or use asap
// pipe
pipe<int> p;
auto id = p.send(12);
auto val = p.recv();
if (val)
cout << "found= " << val.value() << endl; // returns 12
// end
// then
then(()[auto v]{
// returns 12
cout<<"value= "<<v<<endl;}
)(12);
// end
// qace
auto ch1=make_shared<pipe<int>>();
qace(ch1,then(()[auto v]{
// returns 11
cout<<"value= "<<v<<endl;
}))
ch1->send(11);
// end
// select
auto ch1=make_shared<pipe<string>>();
auto ch2=make_shared<pipe<int>>();
select(
ace(ch1,then(()[auto v]{
// returns hey
cout<<"value= "<<v<<endl
})),
ace(ch2,then(()[auto v]{
// returns 11
cout<<"value= "<<v<<endl
})),
)
ch1->send("hey");
ch2->send(11);
// end
// must
auto task = must([]() { cout << "yo" << endl; }, "not succeeded :");
task(1); // invoke as many times you feel like to
// end
// must_all
auto task = must_all("unsucceed 😲", []() { cout << "crazy" << endl; },
[]() { cout << "play" << endl; });
task(1);
this_thread::sleep_for(chrono::seconds(2));
task(2); // play final method
// endnote: the bat files are written only for windows
- use ./cpp_set to setup the meson
- pick or modify any example to play in the main
- use ./cpp_run to run the main.cpp