---
# System prepended metadata

title: <center><i class="fa fa-edit"></i> terminate_task</center>

---

:::warning
# <center><i class="fa fa-edit"></i> terminate_task</center>
:::



[TOC]

### It's helper function to terminate a certain ITTI task
```c=
void terminate_task(task_id_t task_id, module_id_t mod_id) {
  LOG_I(GNB_APP, "sending TERMINATE_MESSAGE to task %s (%d)\n", itti_get_task_name(task_id), task_id);
  MessageDef *msg;
  msg = itti_alloc_new_message (ENB_APP, 0, TERMINATE_MESSAGE);
  itti_send_msg_to_task (task_id, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg);
}

```

### Explanation of some variables

 

| itti_get_task_name |Return the printable string associated with a task id |
| -------- | -------- |
|itti_alloc_new_message | Alloc and memset(0) a new itti message.|
| itti_send_msg_to_task| Send a message to a task (could be itself) |


#### Code of itti_get_task_name
```c=
const char *itti_get_task_name(task_id_t task_id)
```
#### Code of itti_alloc_new_message
```c=
MessageDef *itti_alloc_new_message(task_id_t origin_task_id, instance_t originInstance, MessagesIds message_id)
```
#### Code of itti_send_msg_to_task
```c=
int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *message
```