From 542bc445d2cbc6881941abf2e3c7165fbb1472da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=95=D0=B2=D1=81?= =?UTF-8?q?=D1=82=D1=8E=D1=85=D0=B8=D0=BD?= Date: Thu, 23 Jul 2020 17:03:09 +0300 Subject: [PATCH] Fix an issue "The default stack size is 512kB on macOS" --- src/Worker.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Worker.cpp b/src/Worker.cpp index 6daccf9..e51c465 100644 --- a/src/Worker.cpp +++ b/src/Worker.cpp @@ -215,7 +215,15 @@ class Worker for (int i = 0; i < n; i++) { +#if defined(WIN32) + // The default stack size is 1MB on Windows std::thread thread(std::bind(ThreadProc, this)); +#else + // The default stack size is 512kB on macOS and Linux + boost::thread::attributes attrs; + attrs.set_stack_size(1 << 20); + boost::thread thread(attrs, boost::bind(ThreadProc, this)); +#endif thread.detach(); }