|
BenBot 1.7.5
A chess engine
|
#include <libutil/Threading.hpp>
Public Member Functions | |
| LargeStackThread (const LargeStackThread &)=delete | |
| LargeStackThread (LargeStackThread &&)=delete | |
| LargeStackThread (std::size_t stackSize, std::function< void()> func) | |
| ~LargeStackThread () | |
| void | join () |
| LargeStackThread & | operator= (const LargeStackThread &)=delete |
| LargeStackThread & | operator= (LargeStackThread &&)=delete |
A thread with a stack of a chosen size.
std::thread always uses the platform's default stack size for new threads, which is only 512 KiB on macOS (and 1 MiB on Windows), so code that recurses deeply, like a chess search, should use this class instead.
The thread starts running the function as soon as it's constructed. It must be joined before it's destroyed.
Definition at line 39 of file Threading.hpp.
| util::LargeStackThread::LargeStackThread | ( | std::size_t | stackSize, |
| std::function< void()> | func ) |
Starts a new thread with a stack of at least stackSize bytes, which runs func. stackSize must be a multiple of 64 KiB.
| std::system_error | if the thread can't be created |
| util::LargeStackThread::~LargeStackThread | ( | ) |
|
delete |
|
delete |
| void util::LargeStackThread::join | ( | ) |
Blocks until the thread's function returns. This must be called exactly once.
|
delete |
|
delete |