fix timeout crash
This commit is contained in:
parent
ab0379f7f5
commit
4e9d042c8d
@ -11,7 +11,7 @@ TaskQueueTimeoutFactory::TaskQueueTimeout::TaskQueueTimeout(TaskQueueTimeoutFact
|
|||||||
safety_flag_(PendingTaskSafetyFlag::Create())
|
safety_flag_(PendingTaskSafetyFlag::Create())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
TaskQueueTimeoutFactory::TaskQueueTimeout::~TaskQueueTimeout() {}
|
TaskQueueTimeoutFactory::TaskQueueTimeout::~TaskQueueTimeout() { safety_flag_->SetNotAlive(); }
|
||||||
|
|
||||||
void
|
void
|
||||||
TaskQueueTimeoutFactory::TaskQueueTimeout::Start(DurationMs duration_ms, TimeoutID timeout_id)
|
TaskQueueTimeoutFactory::TaskQueueTimeout::Start(DurationMs duration_ms, TimeoutID timeout_id)
|
||||||
@ -31,12 +31,14 @@ TaskQueueTimeoutFactory::TaskQueueTimeout::Start(DurationMs duration_ms, Timeout
|
|||||||
|
|
||||||
posted_task_expiration_ = timeout_expiration_;
|
posted_task_expiration_ = timeout_expiration_;
|
||||||
auto safety_flag = safety_flag_;
|
auto safety_flag = safety_flag_;
|
||||||
|
|
||||||
parent_.task_queue_.PostDelayedTaskWithPrecision(
|
parent_.task_queue_.PostDelayedTaskWithPrecision(
|
||||||
precision_,
|
precision_,
|
||||||
SafeTask(safety_flag_,
|
SafeTask(safety_flag_,
|
||||||
[timeout_id, this]() {
|
[timeout_id, this]() {
|
||||||
// if (timeout_id != this->timeout_id_) { return; }
|
// if (timeout_id != this->timeout_id_) { return; }
|
||||||
LOGV("timer", "Timeout expired: {}", timeout_id);
|
LOGV("timer", "Timeout expired: {}", timeout_id);
|
||||||
|
// FIXME: this is a bug, the posted_task_expiration_ should be reset to max
|
||||||
ASSERT(posted_task_expiration_ != std::numeric_limits<TimeMs>::max(), "");
|
ASSERT(posted_task_expiration_ != std::numeric_limits<TimeMs>::max(), "");
|
||||||
posted_task_expiration_ = std::numeric_limits<TimeMs>::max();
|
posted_task_expiration_ = std::numeric_limits<TimeMs>::max();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user