---
name: "iv_event"
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"
---

# iv\_event(3)

manage ivykis objects for event notification

## NAME

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

## SYNOPSIS

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

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

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

## DESCRIPTION

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

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

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

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

It is permitted to unregister a **struct iv\_event** 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\_post** can be called from the same thread that **iv\_event\_register** was called from, or from a different thread within the same process, but can not be called from a different process, and can not be called from signal handlers.  If you need this functionality, look at [**iv\_event\_raw**(3)](/iv_event_raw/3.md).

Internally, **iv\_event** is implemented as a wrapper around [**iv\_event\_raw**(3)](/iv_event_raw/3.md), and multiplexes multiple **struct iv\_event** objects over per-thread **struct iv\_event\_raw** objects, to save file descriptors and kernel resources.

## SEE ALSO

[**ivykis**(3)](/ivykis/3.md), [**iv\_event\_raw**(3)](/iv_event_raw/3.md)
