void-packages/srcpkgs/PrusaSlicer/patches/0002-Replace-get_current_thread_name-for-musl.patch
Đoàn Trần Công Danh ec4c2d75fa srcpkgs/[A-Z]*: 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

30 lines
748 B
Diff

--- a/src/libslic3r/Thread.cpp 2021-01-24 13:50:00.469444149 +0100
+++ b/src/libslic3r/Thread.cpp 2021-01-24 13:51:17.109443201 +0100
@@ -171,16 +171,27 @@ bool set_thread_name(boost::thread &thre
return true;
}
+#ifndef __GLIBC__
+thread_local char current_thread_name[16] = { 0 };
+#endif
+
bool set_current_thread_name(const char *thread_name)
{
+#ifndef __GLIBC__
+ strncpy(current_thread_name, thread_name, 15);
+#endif
pthread_setname_np(pthread_self(), thread_name);
return true;
}
std::optional<std::string> get_current_thread_name()
{
+#ifdef __GLIBC__
char buf[16];
return std::string(pthread_getname_np(pthread_self(), buf, 16) == 0 ? buf : "");
+#else
+ return std::string(current_thread_name);
+#endif
}
#endif