diff -r 4ae6d413d3be -r 245a69265bd5 tests/test-threadutils.cpp --- a/tests/test-threadutils.cpp Thu Aug 29 11:46:21 2013 -0700 +++ b/tests/test-threadutils.cpp Thu Aug 29 23:51:20 2013 -0700 @@ -40,13 +40,15 @@ public: TestWorkerModel() : terminate_(false), - result_(0) + result_(0), + started_(false) { } void Run() { { AutoLock lock(main()); + started_ = true; main()->Notify(); } @@ -87,6 +89,10 @@ return result_; } + bool started() { + return started_; + } + void send(int value) { AutoLock lock(&wakeup_); items_.append(value); @@ -99,6 +105,7 @@ LinkedList items_; bool terminate_; int result_; + bool started_; }; class TestThreading : public Test @@ -112,13 +119,14 @@ bool testWorkerModel() { TestWorkerModel test; + ke::AutoPtr thread(new Thread(&test, "TestWorkerModel")); if (!check(thread->Succeeded(), "thread launched")) return false; { AutoLock lock(test.main()); - if (!check(test.main()->Wait(5000) == Wait_Signaled, "thread started within five seconds")) + if (!check(test.started() || test.main()->Wait(5000) == Wait_Signaled, "thread started within five seconds")) return false; }