Commit b12cac3f authored by Alex Chau's avatar Alex Chau Committed by Commit Bot

[Nearby Connections] Flaky shutdown in SubmittableExecutor

- last_task_completed_ should only signal if it's already shutdown,
  otherwise last_task_completed_ will be stuck in insignalled state when
  the first task completes

Bug: 1116437
Change-Id: I8f2172a5af031c5073563b518d77adca29fa85bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352886
Commit-Queue: Alex Chau <alexchau@chromium.org>
Reviewed-by: default avatarHimanshu Jaju <himanshujaju@chromium.org>
Cr-Commit-Position: refs/heads/master@{#798141}
parent 23e55fc6
......@@ -32,7 +32,7 @@ SubmittableExecutor::~SubmittableExecutor() {
base::AutoLock al(lock_);
DCHECK_EQ(num_incomplete_tasks_, 0);
#endif // DCHECK_IS_ON()
} // namespace chrome
}
// Once called, this method will prevent any future calls to Submit() or
// Execute() from posting additional tasks. Previously posted asks will be
......@@ -84,7 +84,7 @@ void SubmittableExecutor::RunTask(Runnable&& runnable) {
base::AutoLock al(lock_);
DCHECK_GE(num_incomplete_tasks_, 1);
if (--num_incomplete_tasks_ == 0)
if (--num_incomplete_tasks_ == 0 && is_shut_down_)
last_task_completed_.Signal();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment