File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,16 +67,16 @@ namespace jam {
6767 });
6868 }
6969
70+
7071 ~Endpoint ()
7172 requires (IsReceiver)
7273 {
7374 while (context_.exclusiveAccess ([&](auto &context) {
7475 if (context.opp_ ) {
75- if (context.opp_ ->unregister_opp (*this )) {
76- context.opp_ = nullptr ;
77- return false ;
76+ if (!context.opp_ ->unregister_opp (*this )) {
77+ return true ;
7878 }
79- return true ;
79+ context. opp_ = nullptr ;
8080 }
8181 return false ;
8282 }));
@@ -133,6 +133,17 @@ namespace jam {
133133
134134 using Receiver = Endpoint<_Receiver>;
135135 using Sender = Endpoint<_Sender>;
136+
137+ template <typename T>
138+ inline std::pair<Receiver, Sender> create_channel () {
139+ using C = Channel<T>;
140+ C::Receiver r;
141+ C::Sender s;
142+
143+ r.register_opp (s);
144+ s.register_opp (r);
145+ return std::make_pair (std::move (r), std::move (s));
146+ }
136147 };
137148
138149} // namespace jam
You can’t perform that action at this time.
0 commit comments