Index: base/message_loop/message_pump_perftest.cc |
diff --git a/base/message_loop/message_pump_perftest.cc b/base/message_loop/message_pump_perftest.cc |
index 7d833befa6158a33b5e64810a928c85abf547798..9f76064ce38e4c586dcb0db1fd5bd1b406ec5da7 100644 |
--- a/base/message_loop/message_pump_perftest.cc |
+++ b/base/message_loop/message_pump_perftest.cc |
@@ -70,6 +70,13 @@ class ScheduleWorkTest : public testing::Test { |
{ |
target_.reset(new Thread("target")); |
target_->StartWithOptions(Thread::Options(target_type, 0u)); |
+ |
+ // Without this, it's possible for the scheduling threads to start and run |
+ // before the target thread. In this case, the scheduling threads will |
+ // call target_message_loop()->ScheduleWork(), which dereferences the |
+ // loop's message pump, which is only created after the target thread has |
+ // finished starting. |
+ target_->WaitUntilThreadStarted(); |
} |
ScopedVector<Thread> scheduling_threads; |