// Batches operations to be executed synchronously on a target thread. // // ScopedOperationsBatcher must only be created on the signaling thread. // // When the batcher goes out of scope (or `Run()` is explicitly called), it // executes all queued tasks in one or more `BlockingCall`s to the target // thread. If the target thread requests a yield during batch execution, the // batcher will cooperatively yield the thread and resume execution in a // subsequent `BlockingCall`. // // Tasks can either have a `void` return type, or return a new task or return an // error. // Any tasks returned by the executed worker thread tasks are collected // and subsequently executed on the calling thread (typically the signaling // thread) after the worker thread operations have completed. class ScopedOperationsBatcher { public: using SimpleBatchTask = absl::AnyInvocable<void() &&>; using FinalizerTask = absl::AnyInvocable<void() &&>; using BatchTaskWithFinalizer =
absl::AnyInvocable<RTCErrorOr<FinalizerTask>() &&>;
// Queues non-nullptr tasks to be executed on the target thread when the // ScopedOperationsBatcher goes out of scope. void Add(SimpleBatchTask task); void AddWithFinalizer(BatchTaskWithFinalizer task);
private: using BatchedTask = std::variant<SimpleBatchTask, BatchTaskWithFinalizer>;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.