Instead of Endpoint class we will use the Pipe class!
This class will be inherited from Synchronizable class (eventuals/lock.h).
The future implementation will be like the following one:
template<typename T>
class Pipe : public Synchronizable {
public:
auto Write( T&& value){
return Synchronized(Lambda([](){
// store this value in a deque
...
notify_();
}));
}
auto Read(){
return Repeat(
Synchronized(
Wait([](auto notify){
...
})));
}
auto Close(){
return Synchronized(Then([]() {
is_closed = true;
notify_();
}));
}
private:
Callback<> notify_ = []() {};
std::deque<T> values_;
bool is_closed_ = false;
}
Instead of
Endpoint
class we will use thePipe
class! This class will be inherited fromSynchronizable
class (eventuals/lock.h
). The future implementation will be like the following one: