---
name: "iv_event_raw"
section: "3"
platform: "linux"
package: "libivykis-dev"
version: "0.43.2-1+b1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/iv_event_raw"
---

# iv\_event\_raw(3)

manage ivykis objects for event notification

## NAME

IV\_EVENT\_RAW\_INIT, iv\_event\_raw\_register, iv\_event\_raw\_unregister, iv\_event\_raw\_post - manage ivykis objects for event notification

## SYNOPSIS

**#include \<iv\_event\_raw.h\>**

```
struct iv_event_raw {
        void            *cookie;
        void            (*handler)(void *);
};
```

**void IV\_EVENT\_RAW\_INIT(struct iv\_event\_raw \****this***);**\
 **int iv\_event\_raw\_register(struct iv\_event\_raw \****this***);**\
 **void iv\_event\_raw\_unregister(struct iv\_event\_raw \****this***);**\
 **void iv\_event\_raw\_post(const struct iv\_event\_raw \****this***);**\

## DESCRIPTION

**iv\_event\_raw** provides a way for delivering events to [**ivykis**(3)](/ivykis/3.md) recipients across thread and process boundaries.

The intended event recipient calls **IV\_EVENT\_RAW\_INIT** on a **struct iv\_event\_raw** object, fills in **-\>cookie** and **-\>handler,** and then calls **iv\_event\_raw\_register** on the object.

To generate an event, call **iv\_event\_raw\_post** on the previously initialized **struct iv\_event\_raw** object.  This will cause the callback specified by **-\>handler** to be called in the thread that the **struct iv\_event\_raw** object was registered in, with **-\>cookie** as its sole argument.

To deinitialize a **struct iv\_event\_raw** object, call **iv\_event\_raw\_unregister** from the same thread that **iv\_event\_raw\_register** was called from on that object.

It is permitted to unregister a **struct iv\_event\_raw** object from any ivykis callback function in the thread it was registered in, including from a callback function triggered by this object, and it is permitted to free the memory corresponding to an unregistered object from its own callback function.

**iv\_event\_raw\_post** can be called from the same thread that **iv\_event\_raw\_register** was called from, from a different thread in the same process, or even from a different process, and can safely be called from signal handlers.

If posting an event only ever needs to be done from within the same process, see [**iv\_event**(3)](/iv_event/3.md) for a lighter-weight alternative to **iv\_event\_raw.**

Internally, **iv\_event\_raw** is implemented by registering a file descriptor (a struct [**iv\_fd**(3)](/iv_fd/3.md)) with the recipient thread's ivykis event loop, and by causing that file descriptor to become readable upon a call to **iv\_event\_raw\_post.**

If [**eventfd**(2)](/eventfd/2.md) is available, it will be used to procure the abovementioned file descriptor.  If not, **iv\_event\_raw** will fall back to [**pipe**(2)](/pipe/2.md) as the source of its file descriptors. [**eventfd**(2)](/eventfd/2.md) is preferred as it requires only one file descriptor table entry (while [**pipe**(2)](/pipe/2.md) requires two), and has much less kernel overhead than [**pipe**(2)](/pipe/2.md) has.

## SEE ALSO

[**ivykis**(3)](/ivykis/3.md), [**iv\_event**(3)](/iv_event/3.md), [**eventfd**(2)](/eventfd/2.md), [**pipe**(2)](/pipe/2.md)
