void-packages/srcpkgs/mesa/patches/musl-stacksize.patch
Đoàn Trần Công Danh 765e304c4b srcpkgs/m*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

35 lines
1 KiB
Diff

diff --git ./include/c11/threads_posix.h ./include/c11/threads_posix.h
index 45cb6075e6..1a2ea1a450 100644
--- a/include/c11/threads_posix.h
+++ b/include/c11/threads_posix.h
@@ -281,15 +281,29 @@ static inline int
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;
}