Commit 33d621c4 authored by Cedric Roux's avatar Cedric Roux
Browse files

- New function: get task name

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4288 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent ad361f21
...@@ -76,8 +76,7 @@ struct message_list_s { ...@@ -76,8 +76,7 @@ struct message_list_s {
typedef struct task_desc_s { typedef struct task_desc_s {
/* Queue of messages belonging to the task */ /* Queue of messages belonging to the task */
STAILQ_HEAD(message_queue_head, message_list_s) STAILQ_HEAD(message_queue_head, message_list_s) message_queue;
message_queue;
/* Number of messages in the queue */ /* Number of messages in the queue */
volatile uint32_t message_in_queue; volatile uint32_t message_in_queue;
...@@ -85,7 +84,7 @@ typedef struct task_desc_s { ...@@ -85,7 +84,7 @@ typedef struct task_desc_s {
pthread_mutex_t message_queue_mutex; pthread_mutex_t message_queue_mutex;
/* Conditional var for message queue and task synchro */ /* Conditional var for message queue and task synchro */
pthread_cond_t message_queue_cond_var; pthread_cond_t message_queue_cond_var;
pthread_t task_thread; pthread_t task_thread;
volatile task_state_t task_state; volatile task_state_t task_state;
} task_desc_t; } task_desc_t;
...@@ -125,6 +124,15 @@ char *itti_get_message_name(MessagesIds message_id) { ...@@ -125,6 +124,15 @@ char *itti_get_message_name(MessagesIds message_id) {
return (itti_desc.messages_info[message_id].name); return (itti_desc.messages_info[message_id].name);
} }
char *itti_get_task_name(task_id_t task_id)
{
thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
DevCheck(thread_id < itti_desc.thread_max, thread_id, itti_desc.thread_max, 0);
return (itti_desc.threads_name[thread_id]);
}
int itti_send_broadcast_message(MessageDef *message_p) { int itti_send_broadcast_message(MessageDef *message_p) {
thread_id_t origin_thread_id; thread_id_t origin_thread_id;
uint32_t i; uint32_t i;
...@@ -371,7 +379,7 @@ void itti_exit_task(void) { ...@@ -371,7 +379,7 @@ void itti_exit_task(void) {
} }
void itti_terminate_tasks(task_id_t task_id) { void itti_terminate_tasks(task_id_t task_id) {
// Sends Terminate signals to all tasks. // Sends Terminate signals to all tasks.
itti_send_terminate_message (task_id); itti_send_terminate_message (task_id);
if (itti_desc.thread_handling_signals >= 0) { if (itti_desc.thread_handling_signals >= 0) {
......
...@@ -115,8 +115,8 @@ void itti_poll_msg(task_id_t task_id, instance_t instance, MessageDef **received ...@@ -115,8 +115,8 @@ void itti_poll_msg(task_id_t task_id, instance_t instance, MessageDef **received
* @returns -1 on failure, 0 otherwise * @returns -1 on failure, 0 otherwise
**/ **/
int itti_create_task(task_id_t task_id, int itti_create_task(task_id_t task_id,
void *(*start_routine) (void *), void *(*start_routine) (void *),
void *args_p); void *args_p);
/** \brief Mark the task as in ready state /** \brief Mark the task as in ready state
* \param task_id task to mark as ready * \param task_id task to mark as ready
...@@ -137,13 +137,18 @@ void itti_terminate_tasks(task_id_t task_id); ...@@ -137,13 +137,18 @@ void itti_terminate_tasks(task_id_t task_id);
**/ **/
char *itti_get_message_name(MessagesIds message_id); char *itti_get_message_name(MessagesIds message_id);
/** \brief Return the printable string associated with a task id
* \param thread_id Id of the task
**/
char *itti_get_task_name(task_id_t task_id);
/** \brief Alloc and memset(0) a new itti message. /** \brief Alloc and memset(0) a new itti message.
* \param origin_task_id Task ID of the sending task * \param origin_task_id Task ID of the sending task
* \param message_id Message ID * \param message_id Message ID
* @returns NULL in case of failure or newly allocated mesage ref * @returns NULL in case of failure or newly allocated mesage ref
**/ **/
inline MessageDef *itti_alloc_new_message( inline MessageDef *itti_alloc_new_message(
task_id_t origin_task_id, task_id_t origin_task_id,
MessagesIds message_id); MessagesIds message_id);
/** \brief handle signals and wait for all threads to join when the process complete. /** \brief handle signals and wait for all threads to join when the process complete.
......
...@@ -131,9 +131,9 @@ typedef struct MessageHeader_s ...@@ -131,9 +131,9 @@ typedef struct MessageHeader_s
{ {
MessagesIds messageId; /**< Unique message id as referenced in enum MessagesIds */ MessagesIds messageId; /**< Unique message id as referenced in enum MessagesIds */
task_id_t originTaskId; /**< ID of the sender task */ task_id_t originTaskId; /**< ID of the sender task */
task_id_t destinationTaskId; /**< ID of the destination task */ task_id_t destinationTaskId; /**< ID of the destination task */
instance_t instance; /* Task instance for virtualization */ instance_t instance; /**< Task instance for virtualization */
MessageHeaderSize size; /**< Message size (not including header size) */ MessageHeaderSize size; /**< Message size (not including header size) */
} MessageHeader; } MessageHeader;
......
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