From 42a87c1c2fc053f318cc1a78ebb5c42a7e3fd157 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Wed, 16 Aug 2017 18:24:57 +0200 Subject: [PATCH] SDR: Name SDR TX and RX threads --- src/common/sdr.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/common/sdr.c b/src/common/sdr.c index b54caf0..94362be 100644 --- a/src/common/sdr.c +++ b/src/common/sdr.c @@ -23,6 +23,7 @@ #include #include #include +#define __USE_GNU #include #include #include "sample.h" @@ -465,6 +466,7 @@ int sdr_start(void __attribute__((__unused__)) *inst) if (sdr_threads) { int rc; pthread_t tid; + char tname[64]; PDEBUG(DSDR, DEBUG_DEBUG, "Create threads!\n"); sdr_thread_write.running = 1; @@ -475,6 +477,10 @@ int sdr_start(void __attribute__((__unused__)) *inst) PDEBUG(DSDR, DEBUG_ERROR, "Failed to create thread!\n"); return rc; } + pthread_getname_np(tid, tname, sizeof(tname)); + strncat(tname, "-sdr_tx", sizeof(tname)); + tname[sizeof(tname) - 1] = '\0'; + pthread_setname_np(tid, tname); sdr_thread_read.running = 1; sdr_thread_read.exit = 0; rc = pthread_create(&tid, NULL, sdr_read_child, inst); @@ -483,6 +489,10 @@ int sdr_start(void __attribute__((__unused__)) *inst) PDEBUG(DSDR, DEBUG_ERROR, "Failed to create thread!\n"); return rc; } + pthread_getname_np(tid, tname, sizeof(tname)); + strncat(tname, "-sdr_rx", sizeof(tname)); + tname[sizeof(tname) - 1] = '\0'; + pthread_setname_np(tid, tname); } return 0;