MCPcopy Create free account
hub / github.com/NVIDIA/stdexec / submit

Method submit

include/exec/linux/io_uring_context.hpp:470–500  ·  view source on GitHub ↗

\brief Submits the given task to the io_uring. \returns true if the task was submitted, false if this io context and this task is have been stopped.

Source from the content-addressed store, hash-verified

468 /// \brief Submits the given task to the io_uring.
469 /// \returns true if the task was submitted, false if this io context and this task is have been stopped.
470 auto submit(__task* __op) noexcept -> bool
471 {
472 // As long as the number of in-flight submissions is not __no_new_submissions, we can
473 // increment the counter and push the operation onto the queue.
474 // If the number of in-flight submissions is __no_new_submissions, we have already
475 // finished the stop operation of the io context and we can immediately stop the operation inline.
476 // Remark: As long as the stopping is in progress we can still submit new operations.
477 // But no operation will be submitted to io uring unless it is a cancellation operation.
478 int __n = 0;
479 while (__n != __no_new_submissions
480 && !__n_submissions_in_flight_.compare_exchange_weak(
481 __n,
482 __n + 1,
483 STDEXEC::__std::memory_order_acquire,
484 STDEXEC::__std::memory_order_relaxed))
485 ;
486 if (__n == __no_new_submissions)
487 {
488 __stop(__op);
489 return false;
490 }
491 else
492 {
493 __requests_.push_front(__op);
494 [[maybe_unused]]
495 int __prev = __n_submissions_in_flight_.fetch_sub(1,
496 STDEXEC::__std::memory_order_relaxed);
497 STDEXEC_ASSERT(__prev > 0);
498 return true;
499 }
500 }
501
502 /// @brief Submit any pending tasks and complete any ready tasks.
503 ///

Callers 8

run_someMethod · 0.45
run_until_stoppedMethod · 0.45
__submit_Method · 0.45
startMethod · 0.45
__submit_Method · 0.45
startMethod · 0.45
submitMethod · 0.45

Calls 3

__stopFunction · 0.85
compare_exchange_weakMethod · 0.80
push_frontMethod · 0.45

Tested by

no test coverage detected