#if RTC_DCHECK_IS_ON
RTC_LOG_THREAD_BLOCK_COUNT();
int expected_block_count = tasks_.empty() ? 0 : 1;
if (target_thread_is_current) { // Many tests in peerconnection_unittests run in single threaded mode where // the operations below will not be accurately measured. Yielding is not // supported for single threaded mode and tasks in those tests may // internally run blocking tasks themselves, which affects the count but is // not useful for the purposes of measuring the multithreaded behavior.
RTC_IGNORE_THREAD_BLOCK_COUNT();
} #endif
RTCError error = RTCError::OK(); while (task_idx < tasks_.size()) {
target_thread_->BlockingCall([&] { while (task_idx < tasks_.size()) {
if (auto* void_task = std::get_if<SimpleBatchTask>(&tasks_[task_idx])) {
std::move (*void_task)();
} else { auto* returning_task =
std::get_if<BatchTaskWithFinalizer>(&tasks_[task_idx]);
RTC_DCHECK(returning_task); auto ret = std::move(*returning_task)();
if (ret.ok()) {
if (ret.value()) {
return_tasks.push_back(std::move(ret.value()));
}
} else {
error = ret.MoveError();
}
}
++task_idx;
if (!error.ok()) { return;
}
if (!target_thread_is_current && target_thread_->HasPendingTasks()) { #if RTC_DCHECK_IS_ON
++expected_block_count; #endif return;
}
}
});
if (!error.ok()) { break;
}
}
tasks_.clear();
for (auto& task : return_tasks) {
std::move(task)();
}
#if RTC_DCHECK_IS_ON // If this triggers, then likely one of the `return_tasks` has issued a // blocking call.
RTC_DCHECK_BLOCK_COUNT_NO_MORE_THAN(expected_block_count); #endif return error;
}
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.