Reimplement itti_wait_tasks_end() to allow custom wait handlers
In the UE, we wish to handle ^C in the UE to send a message before terminating, so we allow custom wait handlers to implement such functionality. Use itti_wait_tasks_unblock() to unblock itti_wait_tasks_end(). Also, implement itti_wait_tasks_end() using semaphores, as signals are not async-signal-safe (and therefore should not be used in a signal handler).
This commit is contained in:
@@ -614,7 +614,7 @@ int main ( int argc, char **argv )
|
||||
//getchar();
|
||||
if(IS_SOFTMODEM_DOSCOPE)
|
||||
load_softscope("enb",NULL);
|
||||
itti_wait_tasks_end();
|
||||
itti_wait_tasks_end(NULL);
|
||||
|
||||
#if USING_GPROF
|
||||
// Save the gprof data now (rather than via atexit) in case we crash while shutting down
|
||||
|
||||
@@ -699,7 +699,7 @@ int main( int argc, char **argv ) {
|
||||
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
||||
//getchar();
|
||||
printf("Entering ITTI signals handler\n");
|
||||
itti_wait_tasks_end();
|
||||
itti_wait_tasks_end(NULL);
|
||||
printf("Returned from ITTI signal handler\n");
|
||||
oai_exit=1;
|
||||
printf("oai_exit=%d\n",oai_exit);
|
||||
|
||||
@@ -153,7 +153,7 @@ int main(int argc, char **argv)
|
||||
itti_send_msg_to_task(TASK_CUUP_E1, 0, msg);
|
||||
|
||||
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
||||
itti_wait_tasks_end();
|
||||
itti_wait_tasks_end(NULL);
|
||||
|
||||
logClean();
|
||||
printf("Bye.\n");
|
||||
|
||||
@@ -733,7 +733,7 @@ int main( int argc, char **argv ) {
|
||||
// wait for end of program
|
||||
printf("Entering ITTI signals handler\n");
|
||||
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
||||
itti_wait_tasks_end();
|
||||
itti_wait_tasks_end(NULL);
|
||||
printf("Returned from ITTI signal handler\n");
|
||||
oai_exit=1;
|
||||
printf("oai_exit=%d\n",oai_exit);
|
||||
|
||||
@@ -563,7 +563,7 @@ int main( int argc, char **argv ) {
|
||||
// wait for end of program
|
||||
printf("Entering ITTI signals handler\n");
|
||||
printf("TYPE <CTRL-C> TO TERMINATE\n");
|
||||
itti_wait_tasks_end();
|
||||
itti_wait_tasks_end(NULL);
|
||||
printf("Returned from ITTI signal handler\n");
|
||||
oai_exit=1;
|
||||
printf("oai_exit=%d\n",oai_exit);
|
||||
|
||||
Reference in New Issue
Block a user