From 4d787625ab74412f971905d59a2f65fba2a7e51f Mon Sep 17 00:00:00 2001 From: Laurent <laurent.thomas@open-cells.com> Date: Tue, 30 Apr 2019 14:25:42 +0200 Subject: [PATCH] still to compile --- common/utils/ocp_itti/intertask_interface.cpp | 2 +- common/utils/system.c | 20 ++++++++--- common/utils/system.h | 1 + executables/nr-gnb.c | 16 +++------ executables/nr-ru.c | 34 +++---------------- executables/nr-softmodem.c | 6 +--- executables/nr-softmodem.h | 2 +- executables/nr-ue.c | 6 ---- openair1/PHY/defs_RU.h | 19 ----------- openair1/PHY/defs_gNB.h | 8 ----- openair1/PHY/thread_NR_UE.h | 4 --- openair1/SCHED/phy_procedures_lte_eNb.c | 15 +++----- openair1/SCHED_NR/nr_ru_procedures.c | 3 +- openair1/SCHED_NR/sched_nr.h | 2 +- openair2/ENB_APP/flexran_agent.c | 1 - openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 1 - openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c | 20 +---------- openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c | 1 - openair2/RRC/LTE/rrc_UE.c | 2 -- openair2/UTIL/ASYNC_IF/link_manager.c | 5 ++- openair3/NAS/COMMON/UTIL/nas_timer.c | 14 ++------ openair3/NAS/UE/UEprocess.c | 7 ---- 22 files changed, 40 insertions(+), 149 deletions(-) diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index e896413b688..3a1fff6e93e 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -281,7 +281,7 @@ extern "C" { int itti_create_task(task_id_t task_id, void *(*start_routine)(void *), void *args_p) { task_list_t *t=&tasks[task_id]; - threadCreate (&t->thread, start_routine, args_p, itti_get_task_name(task_id),-1,OAI_PRIORITY_RT); + threadCreate (&t->thread, start_routine, args_p, (char*)itti_get_task_name(task_id),-1,OAI_PRIORITY_RT); LOG_I(TMR,"Created Posix thread %s\n", itti_get_task_name(task_id) ); return 0; } diff --git a/common/utils/system.c b/common/utils/system.c index 90e5185a67c..0a116661af0 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -239,17 +239,27 @@ void thread_top_init(char *thread_name, mlockall(MCL_CURRENT | MCL_FUTURE); } -void threadTopInit(const char* name, const int affinity, const int priority){ -struct sched_param sparam={0}; +void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority){ + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + pthread_attr_setschedpolicy(&attr, SCHED_FIFO); + struct sched_param sparam={0}; sparam.sched_priority = priority; - AssertFatal(pthread_setschedparam(pthread_self(),SCHED_FIFO , &sparam) == 0,"Error setting thread priority"); - pthread_setname_np(pthread_self(), name); + pthread_attr_setschedparam(&attr, &sparam); + + pthread_create(t, &attr, func, param); + + pthread_setname_np(*t, name); if (affinity != -1 ) { cpu_set_t cpuset; CPU_ZERO(&cpuset); CPU_SET(affinity, &cpuset); - AssertFatal( pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset) == 0, "Error setting processor affinity"); + AssertFatal( pthread_setaffinity_np(*t, sizeof(cpu_set_t), &cpuset) == 0, "Error setting processor affinity"); } + + pthread_attr_destroy(&attr); } // Block CPU C-states deep sleep diff --git a/common/utils/system.h b/common/utils/system.h index b66d4031c9a..a89a6c5b172 100644 --- a/common/utils/system.h +++ b/common/utils/system.h @@ -22,6 +22,7 @@ #ifndef _SYSTEM_H_OAI_ #define _SYSTEM_H_OAI_ #include <stdint.h> +#include <pthread.h> #ifdef __cplusplus extern "C" { #endif diff --git a/executables/nr-gnb.c b/executables/nr-gnb.c index 8b4822ba56c..c76fae828ef 100644 --- a/executables/nr-gnb.c +++ b/executables/nr-gnb.c @@ -38,6 +38,8 @@ #undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all #include "assertions.h" +#include <common/utils/LOG/log.h> +#include <common/utils/system.h> #include "PHY/types.h" @@ -676,8 +678,8 @@ static void* gNB_thread_prach( void* param ) { } */ -extern void init_td_thread(PHY_VARS_gNB *, pthread_attr_t *); -extern void init_te_thread(PHY_VARS_gNB *, pthread_attr_t *); +extern void init_td_thread(PHY_VARS_gNB *); +extern void init_te_thread(PHY_VARS_gNB *); void init_gNB_proc(int inst) { int i=0; @@ -685,8 +687,6 @@ void init_gNB_proc(int inst) { PHY_VARS_gNB *gNB; gNB_L1_proc_t *proc; gNB_L1_rxtx_proc_t *L1_proc,*L1_proc_tx; - pthread_attr_t *attr0=NULL,*attr1=NULL; - //*attr_prach=NULL; LOG_I(PHY,"%s(inst:%d) RC.nb_nr_CC[inst]:%d \n",__FUNCTION__,inst,RC.nb_nr_CC[inst]); for (CC_id=0; CC_id<RC.nb_nr_CC[inst]; CC_id++) { @@ -721,14 +721,6 @@ void init_gNB_proc(int inst) { pthread_mutex_init( &proc->mutex_RU_PRACH,NULL); pthread_cond_init( &proc->cond_prach, NULL); pthread_cond_init( &proc->cond_asynch_rxtx, NULL); - pthread_attr_init( &proc->attr_prach); - pthread_attr_init( &proc->attr_asynch_rxtx); - // pthread_attr_init( &proc->attr_td); - // pthread_attr_init( &proc->attr_te); - pthread_attr_init( &L1_proc->attr); - pthread_attr_init( &L1_proc_tx->attr); - attr0 = &L1_proc->attr; - attr1 = &L1_proc_tx->attr; LOG_I(PHY,"gNB->single_thread_flag:%d\n", gNB->single_thread_flag); if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) { diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 547f4a7d51f..f76cada501d 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -604,7 +604,6 @@ static void *emulatedRF_thread(void *param) { struct timespec req = {0}; req.tv_sec = 0; req.tv_nsec = (numerology>0)? ((microsec * 1000L)/numerology):(microsec * 1000L)*2; - threadTopInit("emulatedRF",-1,OAI_PRIORITY_RT_LOW); wait_sync("emulatedRF_thread"); while(!oai_exit) { @@ -1592,17 +1591,12 @@ extern void ru_fep_full_2thread(RU_t *ru); extern void nr_feptx_ofdm(RU_t *ru); extern void nr_feptx_ofdm_2thread(RU_t *ru); extern void feptx_prec(RU_t *ru); -extern void init_fep_thread(RU_t *ru,pthread_attr_t *attr); -extern void init_nr_feptx_thread(RU_t *ru,pthread_attr_t *attr); +extern void init_fep_thread(RU_t *ru); +extern void init_nr_feptx_thread(RU_t *ru); void init_RU_proc(RU_t *ru) { int i=0; RU_proc_t *proc; - pthread_attr_t *attr_FH=NULL, *attr_FH1=NULL,*attr_prach=NULL,*attr_asynch=NULL, *attr_emulateRF=NULL;// *attr_synch=NULL; - //pthread_attr_t *attr_fep=NULL; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - //pthread_attr_t *attr_prach_br=NULL; -#endif char name[100]; #ifndef OCP_FRAMEWORK LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]); @@ -1639,21 +1633,6 @@ void init_RU_proc(RU_t *ru) { pthread_cond_init( &proc->cond_asynch_rxtx, NULL); pthread_cond_init( &proc->cond_synch,NULL); pthread_cond_init( &proc->cond_gNBs, NULL); - pthread_attr_init( &proc->attr_FH); - pthread_attr_init( &proc->attr_FH1); - pthread_attr_init( &proc->attr_emulateRF); - pthread_attr_init( &proc->attr_prach); - pthread_attr_init( &proc->attr_synch); - pthread_attr_init( &proc->attr_asynch_rxtx); - pthread_attr_init( &proc->attr_fep); -#ifndef DEADLINE_SCHEDULER - attr_FH = &proc->attr_FH; - attr_FH1 = &proc->attr_FH1; - attr_emulateRF = &proc->attr_emulateRF; - attr_prach = &proc->attr_prach; - //attr_synch = &proc->attr_synch; - attr_asynch = &proc->attr_asynch_rxtx; -#endif threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "thread_FH", -1, OAI_PRIORITY_RT ); if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) @@ -1679,9 +1658,9 @@ void init_RU_proc(RU_t *ru) { } if (get_nprocs()>=2) { - if (ru->feprx) init_fep_thread(ru,NULL); + if (ru->feprx) init_fep_thread(ru); - if (ru->feptx_ofdm) nr_init_feptx_thread(ru,NULL); + if (ru->feptx_ofdm) nr_init_feptx_thread(ru); } if (opp_enabled == 1) threadCreate(&ru->ru_stats_thread,ru_stats_thread,(void *)ru, "emulateRF", -1, OAI_PRIORITY_RT_LOW); @@ -1769,11 +1748,6 @@ void kill_RU_proc(int inst) { pthread_cond_destroy(&proc->cond_asynch_rxtx); pthread_cond_destroy(&proc->cond_synch); pthread_cond_destroy(&proc->cond_gNBs); - pthread_attr_destroy(&proc->attr_FH); - pthread_attr_destroy(&proc->attr_prach); - pthread_attr_destroy(&proc->attr_synch); - pthread_attr_destroy(&proc->attr_asynch_rxtx); - pthread_attr_destroy(&proc->attr_fep); } int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) { diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index c724940fb27..00620febd71 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -394,7 +394,6 @@ void reset_stats(FL_OBJECT *button, long arg) { } static void *scope_thread(void *arg) { - threadTopInit("scope",-1,OAI_PRIORITY_RT_LOW); int UE_id, CC_id; int ue_cnt=0; # ifdef ENABLE_XFORMS_WRITE_STATS @@ -1065,10 +1064,7 @@ int main( int argc, char **argv ) { } // CC_id } // UE_id - ret = threadCreate(&forms_thread, scope_thread, NULL, "scope", -1, OAI_PRIORITY_RT_LOW); - - if (ret == 0) - pthread_setname_np( forms_thread, "xforms" ); + threadCreate(&forms_thread, scope_thread, NULL, "scope", -1, OAI_PRIORITY_RT_LOW); printf("Scope thread created, ret=%d\n",ret); } diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index 49e079ae13f..5dfb3e9b83f 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -240,7 +240,7 @@ extern void set_function_spec_param(RU_t *ru); extern void reset_opp_meas(void); extern void print_opp_meas(void); -extern void init_fep_thread(PHY_VARS_gNB *, pthread_attr_t *); +extern void init_fep_thread(PHY_VARS_gNB *); void init_gNB_afterRU(void); diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 21b1edd6172..6629d5155a8 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -538,7 +538,6 @@ int computeSamplesShift(PHY_VARS_NR_UE *UE) { void *UE_thread(void *arg) { //this thread should be over the processing thread to keep in real time - threadTopInit("UE_IQ",1,OAI_PRIORITY_RT_MAX); PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg; // int tx_enabled = 0; openair0_timestamp timestamp; @@ -741,11 +740,6 @@ void init_UE(int nb_inst) { int inst; NR_UE_MAC_INST_t *mac_inst; pthread_t threads[nb_inst]; - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - pthread_attr_setschedpolicy(&attr, SCHED_FIFO); for (inst=0; inst < nb_inst; inst++) { PHY_VARS_NR_UE *UE = PHY_vars_UE_g[inst][0]; diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 76769ed4db3..73e75bb9927 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -191,25 +191,6 @@ typedef struct RU_proc_t_s { int first_rx; /// flag to indicate first TX transmission int first_tx; - /// pthread attributes for RU FH processing thread - pthread_attr_t attr_FH; - pthread_attr_t attr_FH1; - /// pthread attributes for RU prach - pthread_attr_t attr_prach; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - /// pthread attributes for RU prach BL/CE UEs - pthread_attr_t attr_prach_br; -#endif - /// pthread attributes for RU synch thread - pthread_attr_t attr_synch; - /// pthread attributes for asynchronous RX thread - pthread_attr_t attr_asynch_rxtx; - /// pthread attributes for worker fep thread - pthread_attr_t attr_fep; - /// pthread attributes for worker feptx thread - pthread_attr_t attr_feptx; - /// pthread attributes for emulated RF - pthread_attr_t attr_emulateRF; /// scheduling parameters for RU FH thread struct sched_param sched_param_FH; struct sched_param sched_param_FH1; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 24be9688dc0..8a962bb839f 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -373,8 +373,6 @@ typedef struct { int instance_cnt; /// pthread structure for RXn-TXnp4 processing thread pthread_t pthread; - /// pthread attributes for RXn-TXnp4 processing thread - pthread_attr_t attr; /// condition variable for tx processing thread pthread_cond_t cond; /// mutex for RXn-TXnp4 processing thread @@ -430,12 +428,6 @@ typedef struct gNB_L1_proc_t_s { int first_rx; /// flag to indicate first TX transmission int first_tx; - /// pthread attributes for single gNB processing thread - pthread_attr_t attr_single; - /// pthread attributes for prach processing thread - pthread_attr_t attr_prach; - /// pthread attributes for asynchronous RX thread - pthread_attr_t attr_asynch_rxtx; /// scheduling parameters for parallel turbo-decoder thread struct sched_param sched_param_td; /// scheduling parameters for parallel turbo-encoder thread diff --git a/openair1/PHY/thread_NR_UE.h b/openair1/PHY/thread_NR_UE.h index cba7a5ae417..c5db3e14d76 100644 --- a/openair1/PHY/thread_NR_UE.h +++ b/openair1/PHY/thread_NR_UE.h @@ -32,8 +32,6 @@ typedef struct { //pthread_t pthread_slot0_dl_processing; pthread_t pthread_slot1_dl_processing; /// pthread attributes for fep_slot1 processing thread - // pthread_attr_t attr_slot0_dl_processing; - pthread_attr_t attr_slot1_dl_processing; /// condition variable for UE fep_slot1 thread; //pthread_cond_t cond_slot0_dl_processing; pthread_cond_t cond_slot1_dl_processing; @@ -46,8 +44,6 @@ typedef struct { //pthread_t pthread_slot0_dl_processing; pthread_t pthread_dlsch_td; /// pthread attributes for fep_slot1 processing thread - // pthread_attr_t attr_slot0_dl_processing; - pthread_attr_t attr_dlsch_td; /// condition variable for UE fep_slot1 thread; //pthread_cond_t cond_slot0_dl_processing; pthread_cond_t cond_dlsch_td; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 276006ec3be..9409e650a86 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -38,6 +38,7 @@ #include "nfapi_interface.h" #include "fapi_l1.h" #include "common/utils/LOG/log.h" +#include <common/utils/system.h> #include "common/utils/LOG/vcd_signal_dumper.h" #include "assertions.h" @@ -1473,11 +1474,7 @@ void init_td_thread(PHY_VARS_eNB *eNB) { proc->tdp.eNB = eNB; proc->instance_cnt_td = -1; - pthread_attr_init( &proc->attr_td); - pthread_mutex_init( &proc->mutex_td, NULL); - pthread_cond_init( &proc->cond_td, NULL); - - pthread_create(&proc->pthread_td, &proc->attr_td, td_thread, (void*)&proc->tdp); + threadCreate(&proc->pthread_td, td_thread, (void*)&proc->tdp, "TD", -1, OAI_PRIORITY_RT); } void kill_td_thread(PHY_VARS_eNB *eNB) { @@ -1501,12 +1498,10 @@ void init_te_thread(PHY_VARS_eNB *eNB) { proc->tep[i].eNB = eNB; proc->tep[i].instance_cnt_te = -1; - pthread_mutex_init( &proc->tep[i].mutex_te, NULL); - pthread_cond_init( &proc->tep[i].cond_te, NULL); - pthread_attr_init( &proc->tep[i].attr_te); - LOG_I(PHY,"Creating te_thread %d\n",i); - pthread_create(&proc->tep[i].pthread_te, &proc->tep[i].attr_te, te_thread, (void*)&proc->tep[i]); + char txt[128]; + sprintf(txt,"TE_%d", i); + threadCreate(&proc->tep[i].pthread_te, te_thread, (void*)&proc->tep[i], txt, -1, OAI_PRIORITY_RT); } } void kill_te_thread(PHY_VARS_eNB *eNB) { diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index 8a474d36442..a0f12a7287c 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -41,6 +41,7 @@ #include "LAYER2/MAC/mac_extern.h" #include "LAYER2/MAC/mac.h" #include "common/utils/LOG/log.h" +#include "common/utils/system.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "T.h" @@ -196,7 +197,7 @@ static void *nr_feptx_thread(void *param) { return(NULL); } -void nr_init_feptx_thread(RU_t *ru,pthread_attr_t *attr_feptx) { +void nr_init_feptx_thread(RU_t *ru) { RU_proc_t *proc = &ru->proc; diff --git a/openair1/SCHED_NR/sched_nr.h b/openair1/SCHED_NR/sched_nr.h index a120b8c1402..3da78305da9 100644 --- a/openair1/SCHED_NR/sched_nr.h +++ b/openair1/SCHED_NR/sched_nr.h @@ -38,7 +38,7 @@ nr_slot_t nr_slot_select (nfapi_nr_config_request_t *cfg, unsigned char slot); void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_t *cfg, NR_DL_FRAME_PARMS *fp); void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc, int do_meas); void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot); -void nr_init_feptx_thread(RU_t *ru,pthread_attr_t *attr_feptx); +void nr_init_feptx_thread(RU_t *ru); void nr_feptx_ofdm(RU_t *ru); void nr_feptx_ofdm_2thread(RU_t *ru); void nr_feptx0(RU_t *ru,int first_symbol, int num_symbols); diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index 2cf72c40ee7..225a60e2851 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -102,7 +102,6 @@ void *flexran_agent_task(void *args){ } void *receive_thread(void *args) { - threadTopInit("flexran",-1,OAI_PRIORITY_RT_LOW); flexran_agent_info_t *d = args; void *data; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 054bb5fac41..ab00abc0cf1 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -53,7 +53,6 @@ extern pthread_t pdcp_thread; -extern pthread_attr_t pdcp_thread_attr; extern pthread_mutex_t pdcp_mutex; extern pthread_cond_t pdcp_cond; extern int pdcp_instance_cnt; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c index 472c46c94a4..b77151f8a3b 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_netlink.c @@ -97,8 +97,6 @@ pdcp_netlink_init( int i; int nb_inst_enb; int nb_inst_ue; - pthread_attr_t attr; - struct sched_param sched_param; reset_meas(&ip_pdcp_stats_tmp); nb_inst_enb = 1; @@ -141,28 +139,12 @@ pdcp_netlink_init( } if ((nb_inst_ue + nb_inst_enb) > 0) { - if (pthread_attr_init(&attr) != 0) { - LOG_E(PDCP, "[NETLINK]Failed to initialize pthread attribute for Netlink -> PDCP communication (%d:%s)\n", - errno, strerror(errno)); - exit(EXIT_FAILURE); - } - - sched_param.sched_priority = 10; - - pthread_attr_setschedpolicy(&attr, SCHED_RR); - pthread_attr_setschedparam(&attr, &sched_param); /* Create one thread that fetchs packets from the netlink. * When the netlink fifo is full, packets are silently dropped, this behaviour * should be avoided if we want a reliable link. */ - if (pthread_create(&pdcp_netlink_thread, &attr, pdcp_netlink_thread_fct, NULL) != 0) { - LOG_E(PDCP, "[NETLINK]Failed to create new thread for Netlink/PDCP communication (%d:%s)\n", - errno, strerror(errno)); - exit(EXIT_FAILURE); - } - - pthread_setname_np( pdcp_netlink_thread, "PDCP netlink" ); + threadCreate(&pdcp_netlink_thread, pdcp_netlink_thread_fct, "PDCP netlink", -1, OAI_PRIORITY_RT_LOW ); } return 0; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c index c37d665fcca..f1f6ebb7941 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c @@ -45,7 +45,6 @@ extern int oai_exit; extern char UE_flag; pthread_t pdcp_thread; -pthread_attr_t pdcp_thread_attr; pthread_mutex_t pdcp_mutex; pthread_cond_t pdcp_cond; int pdcp_instance_cnt; diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index bef23a83a13..ca4a565250f 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -5477,7 +5477,6 @@ rrc_ue_process_sidelink_radioResourceConfig( void rrc_control_socket_init(){ struct sockaddr_in rrc_ctrl_socket_addr; - pthread_attr_t attr; int optval; // flag value for setsockopt //int n; // message byte size @@ -5506,7 +5505,6 @@ void rrc_control_socket_init(){ exit(1); } - threadTopInit("RRC Control Socket",-1,OAI_PRIORITY_RT); pthread_t rrc_control_socket_thread; threadCreate(&rrc_control_socket_thread, rrc_control_socket_thread_fct, NULL, "RRC/ProSeApp", -1, OAI_PRIORITY_RT); diff --git a/openair2/UTIL/ASYNC_IF/link_manager.c b/openair2/UTIL/ASYNC_IF/link_manager.c index c8b7d59f504..e67b7b0ec88 100644 --- a/openair2/UTIL/ASYNC_IF/link_manager.c +++ b/openair2/UTIL/ASYNC_IF/link_manager.c @@ -30,6 +30,7 @@ #include "link_manager.h" #include "common/utils/LOG/log.h" +#include <common/utils/assertions.h> #include <common/utils/system.h> #include <stdio.h> @@ -104,9 +105,7 @@ link_manager_t *create_link_manager( LOG_D(MAC, "create new link manager\n"); - ret = calloc(1, sizeof(link_manager_t)); - if (ret == NULL) - goto error; + AssertFatal( (ret=calloc(1, sizeof(link_manager_t))) != NULL,""); ret->send_queue = send_queue; ret->receive_queue = receive_queue; diff --git a/openair3/NAS/COMMON/UTIL/nas_timer.c b/openair3/NAS/COMMON/UTIL/nas_timer.c index d92c48f483c..7ddcb61d1dc 100644 --- a/openair3/NAS/COMMON/UTIL/nas_timer.c +++ b/openair3/NAS/COMMON/UTIL/nas_timer.c @@ -397,24 +397,14 @@ static void _nas_timer_handler(int signal) /* Get the timer entry for which the system timer expired */ nas_timer_entry_t *te = _nas_timer_db.head->entry; - /* Execute the callback function */ - pthread_attr_t attr; - pthread_attr_init(&attr); - pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - int rc = pthread_create (&te->pid, &attr, te->cb, te->args); - pthread_attr_destroy(&attr); - - /* Wait for the thread to terminate before releasing the timer entry */ - if (rc == 0) { + threadCreate (&te->pid, te->cb, te->args, "nas-timer", -1, OAI_PRIORITY_RT_LOW); + void *result = NULL; (void) pthread_join(te->pid, &result); - /* TODO: Check returned result ??? */ if (result) { free(result); } - } } #endif diff --git a/openair3/NAS/UE/UEprocess.c b/openair3/NAS/UE/UEprocess.c index 2478eaee29a..7fe1435960f 100644 --- a/openair3/NAS/UE/UEprocess.c +++ b/openair3/NAS/UE/UEprocess.c @@ -150,11 +150,6 @@ int main(int argc, const char *argv[]) (void) _nas_set_signal_handler (SIGINT, _nas_signal_handler); (void) _nas_set_signal_handler (SIGTERM, _nas_signal_handler); - pthread_attr_t attr; - pthread_attr_init (&attr); - pthread_attr_setscope (&attr, PTHREAD_SCOPE_SYSTEM); - pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); - /* * Start thread use to manage the user connection endpoint */ @@ -170,8 +165,6 @@ int main(int argc, const char *argv[]) threadCreate (&network_mngr, _nas_network_mngr, &network_fd, "UE-nas-mgr", -1, OAI_PRIORITY_RT_LOW) ; - pthread_attr_destroy (&attr); - /* * Suspend execution of the main process until all connection * endpoints are still active -- GitLab