Skip to content

Commit 8565672

Browse files
authored
Merge pull request official-stockfish#564 from ianfab/fix_thread_init
Fix thread initialization for mingw (close official-stockfish#563)
2 parents 20aa0b6 + 6f9aa8c commit 8565672

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/thread.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ ThreadPool Threads; // Global object
4141
/// Thread constructor launches the thread and waits until it goes to sleep
4242
/// in idle_loop(). Note that 'searching' and 'exit' should be already set.
4343

44-
Thread::Thread(size_t n) : idx(n) {
45-
4644
#ifdef _WIN32
47-
stdThread = std::thread(&Thread::idle_loop, this);
45+
Thread::Thread(size_t n) : idx(n), stdThread(&Thread::idle_loop, this) {
4846
#else
47+
Thread::Thread(size_t n) : idx(n) {
48+
#endif
49+
50+
#ifndef _WIN32
4951
// With increased MAX_MOVES (for variants) the stack can grow larger than the
5052
// system default. Explicitly set a sufficient stack size.
5153
pthread_attr_t attr;

0 commit comments

Comments
 (0)