Fix setThreadName support for BSD
authorShadowNinja <shadowninja@minetest.net>
Mon, 26 May 2014 19:17:59 +0000 (15:17 -0400)
committerShadowNinja <shadowninja@minetest.net>
Mon, 26 May 2014 19:20:06 +0000 (15:20 -0400)
src/porting.h

index 90bfa2502cd84f86d54649a6f93e561c120f58d2..937ca946446cf90ca8cf01e6d0575bf290c5eca2 100644 (file)
@@ -285,12 +285,19 @@ inline u32 getTime(TimePrecision prec)
                 */
                prctl(PR_SET_NAME, name);
        }
-#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__)
        #include <pthread.h>
+       #include <pthread_np.h>
 
        inline void setThreadName(const char *name) {
                pthread_set_name_np(pthread_self(), name);
        }
+#elif defined(__NetBSD__)
+       #include <pthread.h>
+
+       inline void setThreadName(const char *name) {
+               pthread_setname_np(pthread_self(), name);
+       }
 #elif defined(_MSC_VER)
        typedef struct tagTHREADNAME_INFO {
                DWORD dwType; // must be 0x1000