Skip to content
Snippets Groups Projects
Commit 79ba247f authored by Michael Cook's avatar Michael Cook
Browse files

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
No related branches found
No related tags found
6 merge requests!1757Draft: Use pMAX value in configuration file, instead of hardcoded '23' in asn1_msg.c,!1493fix DL arq errors in UE,!1381integration_2021_wk51_d_2,!1362WIP: integration_2021_wk50_a,!1271Draft: L2 Emulator for NSA Mode,!1059Multi-UE scalability with L2 Emulator
......@@ -416,9 +416,22 @@ task_list_t tasks[TASK_MAX];
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) {
while(1)
sleep(24*3600);
shutting_down = false;
signal(SIGTERM, catch_sigterm);
while (! shutting_down)
{
sleep(24 * 3600);
}
}
void itti_update_lte_time(uint32_t frame, uint8_t slot) {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment