| 210 | } |
| 211 | |
| 212 | void schedule(command_type* op) |
| 213 | { |
| 214 | std::ptrdiff_t n = n_submissions_in_flight_.fetch_add(1, |
| 215 | STDEXEC::__std::memory_order_relaxed); |
| 216 | if (n < 0) |
| 217 | { |
| 218 | if (op->command_ == command_type::command_type::schedule) |
| 219 | { |
| 220 | static_cast<task_type*>(op)->set_stopped_(op); |
| 221 | } |
| 222 | else |
| 223 | { |
| 224 | STDEXEC_ASSERT(op->command_ == command_type::command_type::stop); |
| 225 | static_cast<stop_type*>(op)->set_value_(op); |
| 226 | } |
| 227 | n_submissions_in_flight_.compare_exchange_strong(n, |
| 228 | context_closed, |
| 229 | STDEXEC::__std::memory_order_relaxed); |
| 230 | return; |
| 231 | } |
| 232 | if (command_queue_.push_back(op)) |
| 233 | { |
| 234 | std::scoped_lock lock{ready_mutex_}; |
| 235 | ready_ = true; |
| 236 | cv_.notify_one(); |
| 237 | } |
| 238 | n_submissions_in_flight_.fetch_sub(1, STDEXEC::__std::memory_order_relaxed); |
| 239 | } |
| 240 | |
| 241 | void request_stop() |
| 242 | { |
no test coverage detected