相关疑难解决方法(0)

如何使用C++ 11 std :: thread设置stacksize

我一直在努力熟悉C++ 11中的std :: thread库,并且遇到了绊脚石.

最初我来自posix线程背景,并想知道如何在构造之前设置std :: thread的堆栈大小,因为我似乎无法找到执行此类任务的任何引用.

使用pthreads设置堆栈大小是这样的:

void* foo(void* arg);
.
.
.
.
pthread_attr_t attribute;
pthread_t thread;

pthread_attr_init(&attribute);
pthread_attr_setstacksize(&attribute,1024);
pthread_create(&thread,&attribute,foo,0);
pthread_join(thread,0);
Run Code Online (Sandbox Code Playgroud)

使用std :: thread时有类似的东西吗?

我一直在使用以下参考:

http://en.cppreference.com/w/cpp/thread

c++ multithreading pthreads c++11

33
推荐指数
5
解决办法
2万
查看次数

标签 统计

c++ ×1

c++11 ×1

multithreading ×1

pthreads ×1