Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-gnome
Path: blob/main/cad/PrusaSlicer/files/patch-src_libslic3r_Thread.cpp
16151 views
1
Note that this patch may be removed after FreeBSD 11.x EoL
2
as latest FreeBSD versions have proper
3
pthread_setname_np/pthread_getname_np support.
4
5
--- src/libslic3r/Thread.cpp.orig 2021-01-11 13:01:51 UTC
6
+++ src/libslic3r/Thread.cpp
7
@@ -4,6 +4,7 @@
8
#else
9
// any posix system
10
#include <pthread.h>
11
+ #include <pthread_np.h>
12
#endif
13
14
#include <atomic>
15
@@ -161,26 +162,27 @@ std::optional<std::string> get_current_thread_name()
16
// posix
17
bool set_thread_name(std::thread &thread, const char *thread_name)
18
{
19
- pthread_setname_np(thread.native_handle(), thread_name);
20
+ pthread_set_name_np(thread.native_handle(), thread_name);
21
return true;
22
}
23
24
bool set_thread_name(boost::thread &thread, const char *thread_name)
25
{
26
- pthread_setname_np(thread.native_handle(), thread_name);
27
+ pthread_set_name_np(thread.native_handle(), thread_name);
28
return true;
29
}
30
31
bool set_current_thread_name(const char *thread_name)
32
{
33
- pthread_setname_np(pthread_self(), thread_name);
34
+ pthread_set_name_np(pthread_self(), thread_name);
35
return true;
36
}
37
38
std::optional<std::string> get_current_thread_name()
39
{
40
char buf[16];
41
- return std::string(pthread_getname_np(pthread_self(), buf, 16) == 0 ? buf : "");
42
+ pthread_get_name_np(pthread_self(), buf, 16);
43
+ return std::string(buf);
44
}
45
46
#endif
47
48