pcent
pcent

Reputation: 2029

configuring boost::thread stack size

Is there a way to configure the boost::thread stack size?

Upvotes: 4

Views: 1637

Answers (3)

Stefano Buora
Stefano Buora

Reputation: 1062

Boost evolved and there is a solution: https://www.boost.org/doc/libs/1_61_0/doc/html/thread/thread_management.html#thread.thread_management.tutorial.attributes

Shorten version

boost::thread::attributes attrs;
attrs.set_stack_size(4096*10);
boost::thread deep_thought(attrs, find_the_question, 42);

Hope may help someone in the future.

Upvotes: 2

Simone
Simone

Reputation: 11797

No, AFAIK.

Maybe you could try with native_handle() thread's member function and set the stack size with a call to OS' API (pthread_attr_setstacksize() on POSIX systems maybe?).

Upvotes: 3

ROAR
ROAR

Reputation: 1324

Not that I know of, it inherits the process default value for new threads.

Upvotes: 0

Related Questions