aboutsummaryrefslogtreecommitdiffstats
path: root/cad/PrusaSlicer/files/patch-src_libslic3r_Thread.cpp
blob: d48272fed2feed3bb0260a7244e81939443c98fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Note that this patch may be removed after FreeBSD 11.x EoL
as latest FreeBSD versions have proper
pthread_setname_np/pthread_getname_np support.

--- src/libslic3r/Thread.cpp.orig   2021-01-11 13:01:51 UTC
+++ src/libslic3r/Thread.cpp
@@ -4,6 +4,7 @@
 #else
    // any posix system
    #include <pthread.h>
+   #include <pthread_np.h>
 #endif
 
 #include <atomic>
@@ -161,26 +162,27 @@ std::optional<std::string> get_current_thread_name()
 // posix
 bool set_thread_name(std::thread &thread, const char *thread_name)
 {
-       pthread_setname_np(thread.native_handle(), thread_name);
+       pthread_set_name_np(thread.native_handle(), thread_name);
    return true;
 }
 
 bool set_thread_name(boost::thread &thread, const char *thread_name)
 {
-       pthread_setname_np(thread.native_handle(), thread_name);
+       pthread_set_name_np(thread.native_handle(), thread_name);
    return true;
 }
 
 bool set_current_thread_name(const char *thread_name)
 {
-   pthread_setname_np(pthread_self(), thread_name);
+   pthread_set_name_np(pthread_self(), thread_name);
    return true;
 }
 
 std::optional<std::string> get_current_thread_name()
 {
    char buf[16];
-   return std::string(pthread_getname_np(pthread_self(), buf, 16) == 0 ? buf : "");
+   pthread_get_name_np(pthread_self(), buf, 16);
+   return std::string(buf);
 }
 
 #endif