Path: blob/main/cad/PrusaSlicer/files/patch-src_libslic3r_Thread.cpp
16151 views
Note that this patch may be removed after FreeBSD 11.x EoL1as latest FreeBSD versions have proper2pthread_setname_np/pthread_getname_np support.34--- src/libslic3r/Thread.cpp.orig 2021-01-11 13:01:51 UTC5+++ src/libslic3r/Thread.cpp6@@ -4,6 +4,7 @@7#else8// any posix system9#include <pthread.h>10+ #include <pthread_np.h>11#endif1213#include <atomic>14@@ -161,26 +162,27 @@ std::optional<std::string> get_current_thread_name()15// posix16bool set_thread_name(std::thread &thread, const char *thread_name)17{18- pthread_setname_np(thread.native_handle(), thread_name);19+ pthread_set_name_np(thread.native_handle(), thread_name);20return true;21}2223bool set_thread_name(boost::thread &thread, const char *thread_name)24{25- pthread_setname_np(thread.native_handle(), thread_name);26+ pthread_set_name_np(thread.native_handle(), thread_name);27return true;28}2930bool set_current_thread_name(const char *thread_name)31{32- pthread_setname_np(pthread_self(), thread_name);33+ pthread_set_name_np(pthread_self(), thread_name);34return true;35}3637std::optional<std::string> get_current_thread_name()38{39char buf[16];40- return std::string(pthread_getname_np(pthread_self(), buf, 16) == 0 ? buf : "");41+ pthread_get_name_np(pthread_self(), buf, 16);42+ return std::string(buf);43}4445#endif464748