DescriptionFix race condition in TaskSchedulerTaskTrackerTest.WillPostAndRunLongTaskBeforeShutdown.
Previously, when
TaskSchedulerTaskTrackerTest.WillPostAndRunLongTaskBeforeShutdown ran
with param = SKIP_ON_SHUTDOWN, these events could occur:
Thread Action
-----------------------------------------------------------------------
1 Main Create a skip on shutdown task.
2 Main TaskTracker::WillPostTask()
3 Main Start thread to run task (SimpleThread::Start).
4 Main Start thread to call shutdown (SimpleThread::Start).
5 Shutdown TaskTracker::Shutdown()
Returns immediately since the SKIP_ON_SHUTDOWN task
isn't running yet.
6 Main Expect shutdown to be blocked on the SKIP_ON_SHUTDOWN task.
Error!
So far, we've been lucky and #5 never ran before the SKIP_ON_SHUTDOWN
had time to start running. However, making SimpleThread::Start()
non-blocking (https://codereview.chromium.org/2664953004) made
this series of events occur a few times on bots.
BUG=
Review-Url: https://codereview.chromium.org/2798373002
Cr-Commit-Position: refs/heads/master@{#462843}
Committed: https://chromium.googlesource.com/chromium/src/+/539e731c557cbce418d3ac1ea315f6cc9bd0e21f
Patch Set 1 #Patch Set 2 : self-review #
Total comments: 2
Patch Set 3 : CR-robliao-9 #
Dependent Patchsets: Messages
Total messages: 20 (14 generated)
|