Mesa (master): util: move pipe_thread_is_self from gallium to src/util
Marek Olšák
mareko at kemper.freedesktop.org
Mon Jun 26 00:22:14 UTC 2017
Module: Mesa
Branch: master
Commit: 6884c95ab4e06a418add29052b0a633a7fdad6ae
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6884c95ab4e06a418add29052b0a633a7fdad6ae
Author: Marek Olšák <marek.olsak at amd.com>
Date: Wed Jun 21 14:11:13 2017 +0200
util: move pipe_thread_is_self from gallium to src/util
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
---
src/gallium/auxiliary/os/os_thread.h | 11 -----------
src/gallium/state_trackers/nine/nine_state.c | 2 +-
src/util/u_thread.h | 12 ++++++++++++
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/src/gallium/auxiliary/os/os_thread.h b/src/gallium/auxiliary/os/os_thread.h
index 0a238e5749..10d4695da6 100644
--- a/src/gallium/auxiliary/os/os_thread.h
+++ b/src/gallium/auxiliary/os/os_thread.h
@@ -42,17 +42,6 @@
#include "util/u_thread.h"
-static inline int pipe_thread_is_self( thrd_t thread )
-{
-#if defined(HAVE_PTHREAD)
-# if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \
- (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
- return pthread_equal(pthread_self(), thread);
-# endif
-#endif
- return 0;
-}
-
#define pipe_mutex_assert_locked(mutex) \
__pipe_mutex_assert_locked(&(mutex))
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 30935760ae..a9a41af66e 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -293,7 +293,7 @@ nine_context_get_pipe_multithread( struct NineDevice9 *device )
if (!device->csmt_active)
return device->context.pipe;
- if (!pipe_thread_is_self(ctx->worker))
+ if (!u_thread_is_self(ctx->worker))
nine_csmt_process(device);
return device->context.pipe;
diff --git a/src/util/u_thread.h b/src/util/u_thread.h
index 8eab3a5b94..6b5458af86 100644
--- a/src/util/u_thread.h
+++ b/src/util/u_thread.h
@@ -28,6 +28,7 @@
#define U_THREAD_H_
#include <stdint.h>
+#include <stdbool.h>
#include "c11/threads.h"
@@ -88,4 +89,15 @@ u_thread_get_time_nano(thrd_t thread)
#endif
}
+static inline bool u_thread_is_self(thrd_t thread)
+{
+#if defined(HAVE_PTHREAD)
+# if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__) && \
+ (__GLIBC__ >= 3 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 12))
+ return pthread_equal(pthread_self(), thread);
+# endif
+#endif
+ return false;
+}
+
#endif /* U_THREAD_H_ */
More information about the mesa-commit
mailing list