Commit 79ba247f authored by Michael Cook's avatar Michael Cook

Catch SIGTERM and attempt to exit cleanly

This change is to enable use of gprof which requires the process
call `exit` to write out the collected data.

The UE (lte-uesoftmodem) exits cleanly, but the eNB
(lte-softmodem) crashes as it tries to shut down...
parent f4fc89bc
...@@ -416,9 +416,22 @@ task_list_t tasks[TASK_MAX]; ...@@ -416,9 +416,22 @@ task_list_t tasks[TASK_MAX];
void itti_send_terminate_message(task_id_t task_id) { void itti_send_terminate_message(task_id_t task_id) {
} }
static volatile bool shutting_down;
static void catch_sigterm(int) {
static const char msg[] = "\n** Caught SIGTERM, shutting down\n";
__attribute__((unused))
int unused = write(STDOUT_FILENO, msg, sizeof(msg) - 1);
shutting_down = true;
}
void itti_wait_tasks_end(void) { void itti_wait_tasks_end(void) {
while(1) shutting_down = false;
sleep(24*3600); signal(SIGTERM, catch_sigterm);
while (! shutting_down)
{
sleep(24 * 3600);
}
} }
void itti_update_lte_time(uint32_t frame, uint8_t slot) {} void itti_update_lte_time(uint32_t frame, uint8_t slot) {}
......
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