[PATCH vkd3d 3/4] libs/vkd3d: Set names for internal threads.

Józef Kucia joseph.kucia at gmail.com
Wed Jun 27 08:19:24 CDT 2018


From: Józef Kucia <jkucia at codeweavers.com>

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
 configure.ac               | 2 ++
 libs/vkd3d/command.c       | 4 ++++
 libs/vkd3d/vkd3d_private.h | 8 +++++---
 m4/check-functions.m4      | 7 +++++++
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index daae6464fae9..2773a155cd78 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,6 +93,8 @@ VKD3D_CHECK_FUNC([HAVE_BUILTIN_POPCOUNT], [__builtin_popcount], [__builtin_popco
 VKD3D_CHECK_FUNC([HAVE_SYNC_ADD_AND_FETCH], [__sync_add_and_fetch], [__sync_add_and_fetch((int *)0, 0)])
 VKD3D_CHECK_FUNC([HAVE_SYNC_SUB_AND_FETCH], [__sync_sub_and_fetch], [__sync_sub_and_fetch((int *)0, 0)])
 
+VKD3D_CHECK_LIB_FUNCS([pthread_setname_np], [$PTHREAD_LIBS])
+
 AM_CONDITIONAL([HAVE_WIDL], [test "x$WIDL" != "xno"])
 AM_CONDITIONAL([HAVE_CROSSTARGET32], [test "x$CROSSTARGET32" != "xno"])
 AM_CONDITIONAL([HAVE_CROSSTARGET64], [test "x$CROSSTARGET64" != "xno"])
diff --git a/libs/vkd3d/command.c b/libs/vkd3d/command.c
index ee1d3f6e1018..d29d18edb633 100644
--- a/libs/vkd3d/command.c
+++ b/libs/vkd3d/command.c
@@ -199,6 +199,10 @@ static void *vkd3d_fence_worker_main(void *arg)
     struct vkd3d_fence_worker *worker = arg;
     int rc;
 
+#ifdef HAVE_PTHREAD_SETNAME_NP
+    pthread_setname_np(pthread_self(), "vkd3d_worker");
+#endif
+
     for (;;)
     {
         if ((rc = pthread_mutex_lock(&worker->mutex)))
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h
index 38f0bf38e215..29611b8ccdc5 100644
--- a/libs/vkd3d/vkd3d_private.h
+++ b/libs/vkd3d/vkd3d_private.h
@@ -19,12 +19,14 @@
 #ifndef __VKD3D_PRIVATE_H
 #define __VKD3D_PRIVATE_H
 
-#define VK_NO_PROTOTYPES
-
 #define COBJMACROS
 #define NONAMELESSUNION
-#include "vkd3d.h"
+#define VK_NO_PROTOTYPES
+
+#include "vkd3d_common.h"
 #include "vkd3d_memory.h"
+
+#include "vkd3d.h"
 #include "vkd3d_shader.h"
 
 #include <assert.h>
diff --git a/m4/check-functions.m4 b/m4/check-functions.m4
index 8bb8213153af..17082a179719 100644
--- a/m4/check-functions.m4
+++ b/m4/check-functions.m4
@@ -7,3 +7,10 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([int main(void) { return [$3]; }])],
                          [1],
                          [Define to 1 if you have $2.])],
                [AC_MSG_RESULT([no])])])
+
+dnl VKD3D_CHECK_LIB_FUNCS
+AC_DEFUN([VKD3D_CHECK_LIB_FUNCS],
+[vkd3d_libs_saved="$LIBS"
+LIBS="$LIBS $2"
+AC_CHECK_FUNCS([$1], [$3], [$4])
+LIBS="$vkd3d_libs_saved"])
-- 
2.16.4




More information about the wine-devel mailing list