1234567891011121314151617181920212223242526272829303132333435363738 |
- --- a/src/c11/impl/threads_posix.c 2022-10-04 16:30:04.564345425 -0400
- +++ b/src/c11/impl/threads_posix.c 2022-10-04 16:43:51.794135619 -0400
- @@ -255,18 +255,33 @@
- thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
- {
- struct impl_thrd_param *pack;
- +#ifdef __GLIBC__
- + pthread_attr_t *attrp = NULL;
- +#else
- + pthread_attr_t attr = { 0 };
- + pthread_attr_init(&attr);
- + pthread_attr_setstacksize(&attr, 8388608);
- + pthread_attr_t *attrp = &attr;
- +#endif
- 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, attrp, impl_thrd_routine, pack) != 0) {
- +#ifndef __GLIBC__
- + pthread_attr_destroy(&attr);
- +#endif
- free(pack);
- return thrd_error;
- }
- +#ifndef __GLIBC__
- + pthread_attr_destroy(&attr);
- +#endif
- return thrd_success;
- }
-
- +
- // 7.25.5.2
- thrd_t
- thrd_current(void)
|