我一直在努力熟悉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时有类似的东西吗?
我一直在使用以下参考: