---
name: "rt_task_init"
section: "3"
platform: "linux"
package: "rtlinux"
version: "2.0rel-1"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/rt_task_init/3"
---

# rt\_task\_init(3)

create a real-time task

## NAME

rt\_task\_init - create a real-time task

## WARNING

This is RTL v1.x compatibility function. Please do not use it for new programs.

## SYNOPSIS

```
#define MODULE
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/errno.h>
#include <linux/rtf.h>
```

**int rt\_task\_init(RT\_TASK \*** *task***, void (\****fn***)(int** *data***), int** *data***, int** *stack\_size***, int** *priority***);**

## DESCRIPTION

**rt\_task\_init** creates a real-time task. *task* is a structure the space for which must be provided by the application. *task* must be present during the lifetime of the real-time task; thus it cannot be an automatic variable. *fn* is the entry point of the new task.  The parent task can send a one-integer value *data* to the new task. *stack\_size* is the size of the stack to be used by the new task, and  *priority* is the priority to be given the task.  The highest priority is 1, while the lowest is RT\_LOWEST\_PRIORITY.

The newly created real-time task is initially dormant.  It is normally made active by a call to  **rt\_task\_make\_periodic**.

## RETURN VALUE

On success, 0 is returned.  On failure, a negative value is returned as described below.

## ERRORS

- **-EINVAL**

  *task* is already in use by another task.

- **-ENOMEM**

  space could not be allocated for the real-time task.

## SEE ALSO

[**rt\_task\_delete**(3)](/rt_task_delete/3.md), [**rt\_task\_make\_periodic**(3)](/rt_task_make_periodic/3.md), [**rt\_task\_suspend**(3)](/rt_task_suspend/3.md), [**rt\_task\_wait**(3)](/rt_task_wait/3.md)
