How to set the stacksize with C++11 std::thread

后端 未结 6 1713
野性不改
野性不改 2020-11-29 03:06

I\'ve been trying to familiarize myself with the std::thread library in C++11, and have arrived at a stumbling block.

Initially I come from a posix

6条回答
  •  执念已碎
    2020-11-29 04:01

    Was looking for the answer to this myself just now.

    It appears that while std::thread does not support this, boost::thread does.

    In particular, you can use boost::thread::attributes to accomplish this:

    boost::thread::attributes attrs;
    attrs.set_stack_size(4096*10);
    boost::thread myThread(attrs, fooFunction, 42);
    

提交回复
热议问题