iv\_event(3) ivykis programmer's manual iv\_event(3)

# [NAME](#NAME)

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

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;iv\_event.h&gt;**

```
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](#DESCRIPTION)

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

The intended event recipient calls **IV\_EVENT\_INIT** on a **struct iv\_event** object, fills in **-&gt;cookie** and **-&gt;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 **-&gt;handler** to be called in the thread that the **struct iv\_event** object was registered in, with **-&gt;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)](/man/os/ivykis/iv_event_raw.3).

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

# [SEE ALSO](#SEE_ALSO)

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

2010-09-03 ivykis

---

Document: iv_event_post(3) from ivykis 0.43.2-r10 (Chainguard OS)
Source: https://github.com/buytenh/ivykis
