@brief Submit any pending tasks and complete any ready tasks. This function is not thread-safe and must only be called from the thread that drives the io context.
| 503 | /// |
| 504 | /// This function is not thread-safe and must only be called from the thread that drives the io context. |
| 505 | void run_some() noexcept |
| 506 | { |
| 507 | __n_total_submitted_ -= __completion_queue_.complete(); |
| 508 | STDEXEC_ASSERT(0 <= __n_total_submitted_ |
| 509 | && std::cmp_less_equal(__n_total_submitted_, __params_.cq_entries)); |
| 510 | __u32 __max_submissions = __params_.cq_entries - static_cast<__u32>(__n_total_submitted_); |
| 511 | __pending_.append(__requests_.pop_all_reversed()); |
| 512 | __submission_result __result = __submission_queue_.submit(static_cast<__task_queue&&>( |
| 513 | __pending_), |
| 514 | __max_submissions, |
| 515 | __stop_source_->stop_requested()); |
| 516 | __n_total_submitted_ += __result.__n_submitted; |
| 517 | __n_newly_submitted_ += __result.__n_submitted; |
| 518 | STDEXEC_ASSERT(std::cmp_less_equal(__n_total_submitted_, __params_.cq_entries)); |
| 519 | __pending_ = static_cast<__task_queue&&>(__result.__pending); |
| 520 | while (!__result.__ready.empty()) |
| 521 | { |
| 522 | __n_total_submitted_ -= __completion_queue_.complete( |
| 523 | static_cast<__task_queue&&>(__result.__ready)); |
| 524 | STDEXEC_ASSERT(0 <= __n_total_submitted_); |
| 525 | __pending_.append(__requests_.pop_all_reversed()); |
| 526 | __max_submissions = __params_.cq_entries - static_cast<__u32>(__n_total_submitted_); |
| 527 | __result = __submission_queue_.submit(static_cast<__task_queue&&>(__pending_), |
| 528 | __max_submissions, |
| 529 | __stop_source_->stop_requested()); |
| 530 | __n_total_submitted_ += __result.__n_submitted; |
| 531 | __n_newly_submitted_ += __result.__n_submitted; |
| 532 | STDEXEC_ASSERT(std::cmp_less_equal(__n_total_submitted_, __params_.cq_entries)); |
| 533 | __pending_ = static_cast<__task_queue&&>(__result.__pending); |
| 534 | } |
| 535 | } |
| 536 | |
| 537 | void run_until_stopped() |
| 538 | { |
nothing calls this directly
no test coverage detected