Commit abbffef0 authored by laurent's avatar laurent

fix some exit situations, that was badly done by SIGUSR1 handler

parent c83fc1b5
......@@ -35,6 +35,7 @@
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <platform_types.h>
#include "config_userapi.h"
......
......@@ -37,8 +37,8 @@
#include <dlfcn.h>
#include <arpa/inet.h>
#include <platform_types.h>
#include "config_userapi.h"
extern void exit_fun(const char* s); // lte-softmodem clean exit function
configmodule_interface_t *config_get_if(void)
......
......@@ -38,8 +38,6 @@
extern "C"
{
#endif
/* get rid of "exit_fun undeclared" warning */
extern void exit_fun(const char* s);
#define CONFIG_GETSOURCE ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgmode )
#define CONFIG_GETNUMP ( (config_get_if()==NULL) ? 0 : config_get_if()->num_cfgP )
......
......@@ -288,7 +288,7 @@ extern "C" {
void itti_terminate_tasks(task_id_t task_id) {
// Sends Terminate signals to all tasks.
itti_send_terminate_message (task_id);
pthread_exit (NULL);
usleep(100*1000); // Allow the tasks to receive the message before going returning to main thread
}
int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_id_max, const task_info_t *tasks_info,
......
......@@ -302,8 +302,6 @@ char sv1[64];
}
int proccmd_exit(char *buf, int debug, telnet_printfunc_t prnt)
{
extern void exit_fun(const char* s);
if (debug > 0)
prnt("process module received %s\n",buf);
......
......@@ -930,7 +930,6 @@ typedef enum {
#endif
void exit_fun(const char* s);
#include "common/utils/LOG/log_extern.h"
extern pthread_cond_t sync_cond;
......
......@@ -22,7 +22,11 @@
openair0_device openair0;
volatile int oai_exit=0;
void exit_fun(const char *s) { exit(-1); }
void exit_function(const char* file, const char* function, const int line,const char *s) {
const char * msg= s==NULL ? "no comment": s;
printf("Exiting at: %s:%d %s(), %s\n", file, line, function, msg);
exit(-1);
}
extern unsigned int dlsch_tbs25[27][25],TBStable[27][110];
extern unsigned char offset_mumimo_llr_drange_fix;
......
......@@ -285,4 +285,7 @@ typedef struct protocol_ctxt_s {
(CTXT_Pp)->rnti
#define CHECK_CTXT_ARGS(CTXT_Pp)
#define exit_fun(msg) exit_function(__FILE__,__FUNCTION__,__LINE__,msg)
void exit_function(const char* file, const char* function, const int line, const char* s);
#endif
......@@ -68,7 +68,7 @@ void handle_reconfiguration(mid_t mod_id)
if (restart_L1L2(mod_id) < 0) {
LOG_F(ENB_APP, "can not restart, killing lte-softmodem\n");
itti_terminate_tasks(TASK_PHY_ENB);
exit_fun("can not restart L1L2, killing lte-softmodem");
return;
}
......
......@@ -141,7 +141,6 @@ static struct {
extern double cpuf;
void exit_fun(const char* s);
void init_eNB(int,int);
void stop_eNB(int nb_inst);
......
......@@ -319,13 +319,13 @@ void signal_handler(int sig) {
void exit_fun(const char* s)
void exit_function(const char* file, const char* function, const int line, const char* s)
{
int ru_id;
if (s != NULL) {
printf("%s %s() Exiting OAI softmodem: %s\n",__FILE__, __FUNCTION__, s);
printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s);
}
oai_exit = 1;
......@@ -345,11 +345,11 @@ void exit_fun(const char* s)
}
#if defined(ENABLE_ITTI)
sleep(1); //allow lte-softmodem threads to exit first
#if defined(ENABLE_ITTI)
itti_terminate_tasks (TASK_UNKNOWN);
#endif
exit(1);
}
......
......@@ -240,7 +240,6 @@ extern volatile int start_UE;
#include "threads_t.h"
extern threads_t threads;
extern void exit_fun(const char* s);
// In lte-enb.c
extern void init_eNB(int single_thread_flag,int wait_for_sync);
extern void stop_eNB(int);
......
......@@ -322,13 +322,13 @@ void signal_handler(int sig) {
void exit_fun(const char* s)
void exit_function(const char* file, const char* function, const int line, const char* s)
{
int CC_id;
logClean();
if (s != NULL) {
printf("%s %s() Exiting OAI softmodem: %s\n",__FILE__, __FUNCTION__, s);
printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s);
}
oai_exit = 1;
......@@ -341,10 +341,11 @@ void exit_fun(const char* s)
PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice);
}
#if defined(ENABLE_ITTI)
sleep(1); //allow lte-softmodem threads to exit first
#if defined(ENABLE_ITTI)
itti_terminate_tasks (TASK_UNKNOWN);
#endif
exit(1);
}
#ifdef XFORMS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment