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:
@@ -550,10 +550,13 @@ MessageDef *itti_alloc_new_message_sized(
|
||||
MessagesIds message_id,
|
||||
MessageHeaderSize size);
|
||||
|
||||
/** \brief handle signals and wait for all threads to join when the process complete.
|
||||
This function should be called from the main thread after having created all ITTI tasks.
|
||||
/** \brief Wait for SIGINT/SIGTERM signals to unblock ITTI.
|
||||
This function should be called from the main thread after having created all ITTI tasks. If handler is NULL, a default handler is installed.
|
||||
\param handler a custom signal handler. To unblock, it should call itti_wait_tasks_unblock()
|
||||
**/
|
||||
void itti_wait_tasks_end(void);
|
||||
void itti_wait_tasks_end(void (*handler)(int));
|
||||
/** \brif unblocks ITTI waiting in itti_wait_tasks_end(). **/
|
||||
void itti_wait_tasks_unblock(void);
|
||||
void itti_set_task_real_time(task_id_t task_id);
|
||||
|
||||
/** \brief Send a termination message to all tasks.
|
||||
|
||||
Reference in New Issue
Block a user