Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / src / util / u_thread.h
index 1648d2f58418478e669f0b0369f63fa3131f61e8..af44bcfc1bd6c0ab97b9ca27e146e49a8c4966f8 100644 (file)
 
 #ifdef HAVE_PTHREAD
 #include <signal.h>
+#ifdef HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#endif
+#endif
+
+#ifdef __HAIKU__
+#include <OS.h>
+#endif
+
+#ifdef __FreeBSD__
+/* pthread_np.h -> sys/param.h -> machine/param.h
+ * - defines ALIGN which clashes with our ALIGN
+ */
+#undef ALIGN
+#define cpu_set_t cpuset_t
 #endif
 
 static inline thrd_t u_thread_create(int (*routine)(void *), void *param)
@@ -62,7 +77,7 @@ static inline thrd_t u_thread_create(int (*routine)(void *), void *param)
 static inline void u_thread_setname( const char *name )
 {
 #if defined(HAVE_PTHREAD)
-#if DETECT_OS_LINUX
+#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS
    pthread_setname_np(pthread_self(), name);
 #elif DETECT_OS_FREEBSD || DETECT_OS_OPENBSD
    pthread_set_name_np(pthread_self(), name);
@@ -70,8 +85,10 @@ static inline void u_thread_setname( const char *name )
    pthread_setname_np(pthread_self(), "%s", (void *)name);
 #elif DETECT_OS_APPLE
    pthread_setname_np(name);
+#elif DETECT_OS_HAIKU
+   rename_thread(find_thread(NULL), name);
 #else
-#error Not sure how to call pthread_setname_np
+#warning Not sure how to call pthread_setname_np
 #endif
 #endif
    (void)name;
@@ -142,7 +159,7 @@ util_get_L3_for_pinned_thread(thrd_t thread, unsigned cores_per_L3)
 static inline int64_t
 u_thread_get_time_nano(thrd_t thread)
 {
-#if defined(__linux__) && defined(HAVE_PTHREAD)
+#if defined(HAVE_PTHREAD) && !defined(__APPLE__) && !defined(__HAIKU__)
    struct timespec ts;
    clockid_t cid;