parent
653edd4b02
commit
724d6267c8
|
@ -623,6 +623,16 @@ int main()
|
|||
}"
|
||||
PTHREAD_SETNAME_NP_ONE_PARAM
|
||||
)
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <pthread.h>
|
||||
#include <pthread_np.h>
|
||||
int main()
|
||||
{
|
||||
pthread_setname_np(pthread_self(), \"%s\", \"testname\");
|
||||
return 0;
|
||||
}"
|
||||
PTHREAD_SETNAME_NP_THREE_PARAMS
|
||||
)
|
||||
ENDIF()
|
||||
CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
|
||||
ELSE()
|
||||
|
@ -639,6 +649,15 @@ int main()
|
|||
}"
|
||||
PTHREAD_SETNAME_NP_ONE_PARAM
|
||||
)
|
||||
CHECK_C_SOURCE_COMPILES("
|
||||
#include <pthread.h>
|
||||
int main()
|
||||
{
|
||||
pthread_setname_np(pthread_self(), \"%s\", \"testname\");
|
||||
return 0;
|
||||
}"
|
||||
PTHREAD_SETNAME_NP_THREE_PARAMS
|
||||
)
|
||||
ENDIF()
|
||||
CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np pthread.h HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
|
||||
ENDIF()
|
||||
|
|
|
@ -500,6 +500,8 @@ void althrd_setname(althrd_t thr, const char *name)
|
|||
#if defined(PTHREAD_SETNAME_NP_ONE_PARAM)
|
||||
if(althrd_equal(thr, althrd_current()))
|
||||
pthread_setname_np(name);
|
||||
#elif defined(PTHREAD_SETNAME_NP_THREE_PARAMS)
|
||||
pthread_setname_np(thr, "%s", (void*)name);
|
||||
#else
|
||||
pthread_setname_np(thr, name);
|
||||
#endif
|
||||
|
|
|
@ -197,6 +197,9 @@
|
|||
/* Define if pthread_setname_np() only accepts one parameter */
|
||||
#cmakedefine PTHREAD_SETNAME_NP_ONE_PARAM
|
||||
|
||||
/* Define if pthread_setname_np() accepts three parameters */
|
||||
#cmakedefine PTHREAD_SETNAME_NP_THREE_PARAMS
|
||||
|
||||
/* Define if we have pthread_set_name_np() */
|
||||
#cmakedefine HAVE_PTHREAD_SET_NAME_NP
|
||||
|
||||
|
|
Loading…
Reference in New Issue