mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-09-13 09:16:14 -07:00
build: Check how many arguments pthread_setname_np() takes.
Based on a patch by Chip Davis. Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
aa12c0a751
commit
d9858b63b9
@ -94,7 +94,7 @@ 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_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_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])
|
VKD3D_CHECK_PTHREAD_SETNAME_NP
|
||||||
|
|
||||||
AM_CONDITIONAL([BUILD_DEMOS], [test "x$enable_demos" = "xyes"])
|
AM_CONDITIONAL([BUILD_DEMOS], [test "x$enable_demos" = "xyes"])
|
||||||
AM_CONDITIONAL([HAVE_WIDL], [test "x$WIDL" != "xno"])
|
AM_CONDITIONAL([HAVE_WIDL], [test "x$WIDL" != "xno"])
|
||||||
|
@ -200,9 +200,7 @@ static void *vkd3d_fence_worker_main(void *arg)
|
|||||||
struct vkd3d_fence_worker *worker = arg;
|
struct vkd3d_fence_worker *worker = arg;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
vkd3d_set_thread_name("vkd3d_worker");
|
||||||
pthread_setname_np(pthread_self(), "vkd3d_worker");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -826,4 +826,13 @@ HRESULT vkd3d_load_vk_device_procs(struct vkd3d_vk_device_procs *procs,
|
|||||||
|
|
||||||
extern const char vkd3d_build[];
|
extern const char vkd3d_build[];
|
||||||
|
|
||||||
|
static inline void vkd3d_set_thread_name(const char *name)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_PTHREAD_SETNAME_NP_2)
|
||||||
|
pthread_setname_np(pthread_self(), name);
|
||||||
|
#elif defined(HAVE_PTHREAD_SETNAME_NP_1)
|
||||||
|
pthread_setname_np(name);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __VKD3D_PRIVATE_H */
|
#endif /* __VKD3D_PRIVATE_H */
|
||||||
|
@ -14,3 +14,42 @@ AC_DEFUN([VKD3D_CHECK_LIB_FUNCS],
|
|||||||
LIBS="$LIBS $2"
|
LIBS="$LIBS $2"
|
||||||
AC_CHECK_FUNCS([$1], [$3], [$4])
|
AC_CHECK_FUNCS([$1], [$3], [$4])
|
||||||
LIBS="$vkd3d_libs_saved"])
|
LIBS="$vkd3d_libs_saved"])
|
||||||
|
|
||||||
|
dnl VKD3D_CHECK_WHICH_PTHREAD_SETNAME_NP
|
||||||
|
AC_DEFUN([VKD3D_CHECK_WHICH_PTHREAD_SETNAME_NP],
|
||||||
|
[AC_MSG_CHECKING([how many arguments pthread_set_np() takes])
|
||||||
|
AC_CACHE_VAL([vkd3d_cv_which_pthread_set_np], [
|
||||||
|
|
||||||
|
vkd3d_cv_which_pthread_set_np=unknown
|
||||||
|
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
|
||||||
|
[pthread_setname_np(pthread_self(), "conftest")])],
|
||||||
|
[vkd3d_cv_which_pthread_set_np=two])
|
||||||
|
|
||||||
|
AS_IF([test "$vkd3d_cv_which_pthread_set_np" = "unknown"],
|
||||||
|
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <pthread.h>],
|
||||||
|
[pthread_setname_np("conftest")])],
|
||||||
|
[vkd3d_cv_which_pthread_set_np=one])])
|
||||||
|
|
||||||
|
]) dnl AC_CACHE_VAL
|
||||||
|
|
||||||
|
AS_CASE(["$vkd3d_cv_which_pthread_set_np"],
|
||||||
|
[one],
|
||||||
|
[AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_1], [1],
|
||||||
|
[Define to 1 if you have the one-argument variant of pthread_setname_np().])
|
||||||
|
AC_MSG_RESULT([one])],
|
||||||
|
|
||||||
|
[two],
|
||||||
|
[AC_DEFINE([HAVE_PTHREAD_SETNAME_NP_2], [1],
|
||||||
|
[Define to 1 if you have the two-argument variant of pthread_setname_np().])
|
||||||
|
AC_MSG_RESULT([two])],
|
||||||
|
|
||||||
|
[AC_MSG_RESULT([unknown])])
|
||||||
|
|
||||||
|
]) dnl AC_DEFUN
|
||||||
|
|
||||||
|
dnl VKD3D_CHECK_PTHREAD_SETNAME_NP
|
||||||
|
AC_DEFUN([VKD3D_CHECK_PTHREAD_SETNAME_NP],
|
||||||
|
[VKD3D_CHECK_LIB_FUNCS([pthread_setname_np], [$PTHREAD_LIBS])
|
||||||
|
AS_IF([test "x$ac_cv_func_pthread_setname_np" = "xyes"],
|
||||||
|
[VKD3D_CHECK_WHICH_PTHREAD_SETNAME_NP])])
|
||||||
|
Loading…
Reference in New Issue
Block a user