From f01c78e5329254f00004014c12118a9f2716b7ae Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@eurecom.fr>
Date: Sun, 28 Oct 2018 13:36:42 +0100
Subject: [PATCH] Set thread names for FlexRAN and PROTO rx_thread

---
 openair2/ENB_APP/flexran_agent.c          | 4 +++-
 openair2/LAYER2/PROTO_AGENT/proto_agent.c | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c
index 79cb6ea97f..d6402658a9 100644
--- a/openair2/ENB_APP/flexran_agent.c
+++ b/openair2/ENB_APP/flexran_agent.c
@@ -26,11 +26,12 @@
  * \version 0.1
  */
 
+#define _GNU_SOURCE
 #include "flexran_agent.h"
 
+#include <pthread.h>
 #include <arpa/inet.h>
 
-void *send_thread(void *args);
 void *receive_thread(void *args);
 pthread_t new_thread(void *(*f)(void *), void *b);
 Protocol__FlexranMessage *flexran_agent_timeout(void* args);
@@ -110,6 +111,7 @@ void *receive_thread(void *args) {
   err_code_t             err_code=0;
 
   Protocol__FlexranMessage *msg;
+  pthread_setname_np(pthread_self(), "flexran_rx_thr");
   
   while (1) {
 
diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c
index 38c7c32b52..60640d4872 100644
--- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c
+++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c
@@ -33,6 +33,7 @@
  * \date 2016
  * \version 0.1
  */
+#define _GNU_SOURCE
 #include "proto_agent_common.h"
 #include "common/utils/LOG/log.h"
 #include "proto_agent.h"
@@ -40,6 +41,8 @@
 #include "proto_agent_net_comm.h"
 #include "proto_agent_async.h" 
 
+#include <pthread.h>
+
 #define  ENB_AGENT_MAX 9
 
 proto_agent_instance_t proto_agent[MAX_DU];
@@ -250,6 +253,7 @@ proto_agent_receive(void *args)
   int                   priority;
   err_code_t             err_code;
 
+  pthread_setname_np(pthread_self(), "proto_rx");
   Protocol__FlexsplitMessage *msg;
   uint8_t *ser_msg;
   
-- 
2.26.2