Set thread names for better debugging

This commit is contained in:
SChernykh
2025-03-13 11:19:58 +01:00
parent 37e8cc01cf
commit d1dd95d9c9
10 changed files with 59 additions and 0 deletions

View File

@@ -345,6 +345,16 @@ int main(int argc, char* argv[])
return 0;
}" HAVE_RES_QUERY)
check_c_source_compiles("
#define _GNU_SOURCE
#include <pthread.h>
int main()
{
pthread_setname_np(pthread_self(), \"Main\");
return 0;
}" HAVE_PTHREAD_SETNAME_NP)
set(CMAKE_REQUIRED_LIBRARIES)
if (HAVE_BUILTIN_CLZLL)
@@ -366,6 +376,10 @@ if (HAVE_RES_QUERY)
endif()
endif()
if (HAVE_PTHREAD_SETNAME_NP)
add_definitions(/DHAVE_PTHREAD_SETNAME_NP)
endif()
add_definitions("-DRAPIDJSON_PARSE_DEFAULT_FLAGS=kParseTrailingCommasFlag")
add_executable(${CMAKE_PROJECT_NAME} ${HEADERS} ${SOURCES})