blob: 0579c1787a481f735f2bff6d6c84c034d980a765 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
index 45cb6075e6..53ca26506c 100644
--- a/include/c11/threads_posix.h
+++ b/include/c11/threads_posix.h
@@ -281,12 +281,23 @@ static inline int
thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
{
struct impl_thrd_param *pack;
+ size_t stack_size;
+ pthread_attr_t* attr;
+ pthread_attr_t attr_storage;
+
+ attr = NULL;
+ stack_size = 2 << 20;
+ attr = &attr_storage;
+
+ pthread_attr_init(attr);
+ pthread_attr_setstacksize(attr, stack_size);
+
assert(thr != NULL);
pack = (struct impl_thrd_param *)malloc(sizeof(struct impl_thrd_param));
if (!pack) return thrd_nomem;
pack->func = func;
pack->arg = arg;
- if (pthread_create(thr, NULL, impl_thrd_routine, pack) != 0) {
+ if (pthread_create(thr, attr, impl_thrd_routine, pack) != 0) {
free(pack);
return thrd_error;
}
|