From d9a80b16f0e43613f724cbfabffbd4017ad2fb0c Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Mon, 10 Aug 2020 16:22:02 +1000 Subject: [PATCH] [common] properly define _GNU_SOURCE and set the thread names --- VERSION | 2 +- common/CMakeLists.txt | 2 ++ common/src/platform/linux/crash.c | 1 - common/src/platform/linux/thread.c | 4 +++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 2be9929b..1730c086 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B2-rc3-0-g82e0b7b6ab+1 \ No newline at end of file +B2-rc3-1-g90d0cd873d+1 \ No newline at end of file diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 82d28c08..e78196cc 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -5,6 +5,8 @@ include_directories( ${PROJECT_SOURCE_DIR}/include ) +add_definitions(-D_GNU_SOURCE) + if(ENABLE_BACKTRACE) add_definitions(-DENABLE_BACKTRACE) endif() diff --git a/common/src/platform/linux/crash.c b/common/src/platform/linux/crash.c index 1272b42e..4c412a3c 100644 --- a/common/src/platform/linux/crash.c +++ b/common/src/platform/linux/crash.c @@ -17,7 +17,6 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#define _GNU_SOURCE #include "common/crash.h" #include "common/debug.h" diff --git a/common/src/platform/linux/thread.c b/common/src/platform/linux/thread.c index 1d42c574..83d4c8d2 100644 --- a/common/src/platform/linux/thread.c +++ b/common/src/platform/linux/thread.c @@ -54,6 +54,8 @@ bool lgCreateThread(const char * name, LGThreadFunction function, void * opaque, *handle = NULL; return false; } + + pthread_setname_np((*handle)->handle, name); return true; } @@ -71,4 +73,4 @@ bool lgJoinThread(LGThread * handle, int * resultCode) free(handle); return true; -} \ No newline at end of file +}