mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 13:50:40 +01:00
TaskQueueStdlib: remove dependency on Event::kForever being int.
While transitioning to TimeDelta, WebRTC and Chromium has a different idea about what type rtc::Event::kForever is. Code can't assume rtc::Event::kForever is the same type as timed wait arguments. Bug: webrtc:14366 Change-Id: I4783c7de6d567c70b211de9aa9889417f6fafba1 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272060 Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org> Commit-Queue: Markus Handell <handellm@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37810}
This commit is contained in:
parent
3d38cd3c41
commit
6df49b9d01
1 changed files with 16 additions and 2 deletions
|
@ -74,7 +74,13 @@ class TaskQueueStdlib final : public TaskQueueBase {
|
|||
struct NextTask {
|
||||
bool final_task = false;
|
||||
absl::AnyInvocable<void() &&> run_task;
|
||||
int64_t sleep_time_ms = rtc::Event::kForever;
|
||||
// TODO(bugs.webrtc.org/14366): While transitioning to TimeDelta, WebRTC and
|
||||
// Chromium has a different idea about what type rtc::Event::kForever is.
|
||||
// Code can't assume rtc::Event::kForever is the same type as timed wait
|
||||
// arguments.
|
||||
// Change `sleep_time_ms` to be explicit type, default value
|
||||
// `rtc::Event::kForever` once transition is complete.
|
||||
absl::optional<int64_t> sleep_time_ms;
|
||||
};
|
||||
|
||||
static rtc::PlatformThread InitializeThread(TaskQueueStdlib* me,
|
||||
|
@ -246,7 +252,15 @@ void TaskQueueStdlib::ProcessTasks() {
|
|||
continue;
|
||||
}
|
||||
|
||||
flag_notify_.Wait(task.sleep_time_ms);
|
||||
// TODO(bugs.webrtc.org/14366): While transitioning to TimeDelta, WebRTC and
|
||||
// Chromium has a different idea about what type rtc::Event::kForever is.
|
||||
// Code can't assume rtc::Event::kForever is the same type as timed wait
|
||||
// arguments.
|
||||
// Simplify after transitioning is complete.
|
||||
if (task.sleep_time_ms.has_value())
|
||||
flag_notify_.Wait(task.sleep_time_ms.value());
|
||||
else
|
||||
flag_notify_.Wait(rtc::Event::kForever);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue