From 99ae47716ac605286e60634632cb5eccac9a63ce Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Sun, 13 Jan 2013 23:51:15 +0100 Subject: [PATCH] Re-add the hack This reverts commit 869c9244101 I misunderstood here. Actually it can happen that thread is created but still not entered idle_loop and at the same time start_searching() is called. Becuase 'do_sleep' is set start_searching() will set it to false and start the search, but when, at last, the thread enters idle_loop(), resets the flag and goes to sleep: not what we want. Revert the hack waiting for a better solution in the next patches. No functional change. --- src/thread.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/thread.cpp b/src/thread.cpp index d674c3ab..1f5dc823 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -49,7 +49,8 @@ Thread::Thread(Fn fn) : splitPoints() { curSplitPoint = NULL; start_fn = fn; idx = Threads.size(); - do_sleep = true; + + do_sleep = (fn != &Thread::main_loop); // Avoid a race with start_searching() if (!thread_create(handle, start_routine, this)) { -- 2.39.2