Skip to content

Commit

Permalink
Fix an issue "The default stack size is 512kB on macOS"
Browse files Browse the repository at this point in the history
  • Loading branch information
Андрей Евстюхин committed Jul 23, 2020
1 parent 926cb25 commit 542bc44
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 542bc44

Please sign in to comment.