:::warning
# <center><i class="fa fa-edit"></i> Creating of gNB task (code)</center>
:::
[TOC]
### Here is a function called create_gNB_tasks with such code
```c=
int create_gNB_tasks(uint32_t gnb_nb) {
LOG_D(GNB_APP, "%s(gnb_nb:%d)\n", __FUNCTION__, gnb_nb);
itti_wait_ready(1);
if (gnb_nb > 0) {
if(itti_create_task(TASK_SCTP, sctp_eNB_task, NULL) < 0) {
LOG_E(SCTP, "Create task for SCTP failed\n");
return -1;
}
if (is_x2ap_enabled()) {
if(itti_create_task(TASK_X2AP, x2ap_task, NULL) < 0) {
LOG_E(X2AP, "Create task for X2AP failed\n");
}
} else {
LOG_I(X2AP, "X2AP is disabled.\n");
}
}
```
### Explanation of some variables
| LOG_E | Errror message |
| -------- | -------- |
| LOG_I | Information message |
| itti_wait_ready | Doing nothing becuse nothing put inside of function (example below) |
| itti_create_task | Create task (example below) |
| is_x2ap_enabled | Dummy function to avoid linking error at compilation of nr-dlsim |
#### Code of itti_wait_ready
```c=
void itti_wait_ready(int wait_tasks) {
}
```
#### Code of itti_create_task
```c=
int itti_create_task(task_id_t task_id,
void *(*start_routine)(void *),
void *args_p) {
task_list_t *t=tasks[task_id];
threadCreate (&t->thread, start_routine, args_p, (char *)itti_get_task_name(task_id),-1,OAI_PRIORITY_RT);
LOG_I(TMR,"Created Posix thread %s\n", itti_get_task_name(task_id) );
return 0;
}
```
#### Code of is_x2ap_enabled
```c=
int is_x2ap_enabled(void)
{
return 0;
}
```