PrusaSlicer: fix musl build
This commit is contained in:
parent
5b55263caf
commit
0e52e496b4
1 changed files with 30 additions and 0 deletions
|
@ -0,0 +1,30 @@
|
|||
--- src/libslic3r/Thread.cpp.orig 2021-01-24 13:50:00.469444149 +0100
|
||||
+++ 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
|
Loading…
Reference in a new issue