MCPcopy Create free account
hub / github.com/boostorg/asio / either_blocking_executor

Class either_blocking_executor

test/execution/prefer_only.cpp:161–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159} // namespace boost
160
161struct either_blocking_executor
162{
163 execution::blocking_t blocking_;
164
165 explicit either_blocking_executor(execution::blocking_t b)
166 : blocking_(b)
167 {
168 }
169
170 execution::blocking_t query(execution::blocking_t) const noexcept
171 {
172 return blocking_;
173 }
174
175 either_blocking_executor require(execution::blocking_t::possibly_t) const
176 {
177 return either_blocking_executor(execution::blocking.possibly);
178 }
179
180 either_blocking_executor require(execution::blocking_t::never_t) const
181 {
182 return either_blocking_executor(execution::blocking.never);
183 }
184
185 template <typename F>
186 void execute(const F&) const
187 {
188 if (blocking_ == execution::blocking.never)
189 ++never_blocking_count;
190 else
191 ++possibly_blocking_count;
192 }
193
194 friend bool operator==(const either_blocking_executor& a,
195 const either_blocking_executor& b) noexcept
196 {
197 return a.blocking_ == b.blocking_;
198 }
199
200 friend bool operator!=(const either_blocking_executor& a,
201 const either_blocking_executor& b) noexcept
202 {
203 return a.blocking_ != b.blocking_;
204 }
205};
206
207namespace boost {
208namespace asio {

Callers 3

requireMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected