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

# rtf\_create\_handler(3)

install a handler for real-time fifo data

## NAME

rtf\_create\_handler - install a handler for real-time fifo data

## SYNOPSIS

```
#include <rtl_fifo.h>
```

**int rtf\_create\_handler(unsigned int** *fifo***, int (\*** *handler***)(unsigned int fifo));**

## DESCRIPTION

**rtf\_create\_handler** installs a handler which is executed when data is written to or read from a real-time fifo (RT-FIFO). *fifo* is an RT-FIFO that must have previously been created with a call to **rtf\_create\_fifo**. *handler* is then called whenever a Linux process accesses that fifo.

**rtf\_create\_handler** is often used in conjunction with  **rtf\_get** to process data acquired asynchronously from a Linux process.  The installed handler calls **rtf\_get** when data is present.  Because the handler is only executed when there is activity on the fifo, polling is not necessary.

The RT-FIFO is a mechanism, implemented as a character device, to communicate between real-time tasks and ordinary Linux processes.  The rtf\_\* functions are used by the real-time tasks; Linux processes use standard character device access functions such as **[read(2)](/read/2.md)**, **[write(2)](/write/2.md)**, and **[select(2)](/select/2.md)**.

## RETURN VALUE

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

## ERRORS

- **-EINVAL**

  *fifo* is greater than or equal to RTF\_NO, or is not a valid RT-FIFO identifier; or *handler* is NULL.

## SEE ALSO

[**rtf\_create**(3)](/rtf_create/3.md), [**rtf\_destroy**(3)](/rtf_destroy/3.md), [**rtf\_get**(3)](/rtf_get/3.md), [**rtf\_put**(3)](/rtf_put/3.md)
