Kore
Loading...
Searching...
No Matches
event.h File Reference

An event is a simple threading-object that allows a thread to wait for something to happen on another thread. More...

#include <kinc/global.h>
#include <kinc/backend/event.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  kinc_event

Typedefs

typedef struct kinc_event kinc_event_t

Functions

KINC_FUNC void kinc_event_init (kinc_event_t *event, bool auto_clear)
 Initializes an event-object.
KINC_FUNC void kinc_event_destroy (kinc_event_t *event)
 Destroys an event-object.
KINC_FUNC void kinc_event_signal (kinc_event_t *event)
 Signals an event which allows threads which are waiting for the event to continue.
KINC_FUNC void kinc_event_wait (kinc_event_t *event)
 Waits for an event to be signaled.
KINC_FUNC bool kinc_event_try_to_wait (kinc_event_t *event, double timeout)
 Waits for an event to be signaled or the provided timeout to run out - whatever happens first.
KINC_FUNC void kinc_event_reset (kinc_event_t *event)
 Resets an event to an unsignaled state.

Detailed Description

An event is a simple threading-object that allows a thread to wait for something to happen on another thread.

Function Documentation

◆ kinc_event_destroy()

KINC_FUNC void kinc_event_destroy ( kinc_event_t * event)

Destroys an event-object.

Parameters
eventThe event to destroy

◆ kinc_event_init()

KINC_FUNC void kinc_event_init ( kinc_event_t * event,
bool auto_clear )

Initializes an event-object.

Parameters
eventThe event to initialize
auto_clearWhen auto-clear is true, the event is automatically reset to an unsignaled state after a successful wait-operation

◆ kinc_event_reset()

KINC_FUNC void kinc_event_reset ( kinc_event_t * event)

Resets an event to an unsignaled state.

Parameters
eventThe event to reset

◆ kinc_event_signal()

KINC_FUNC void kinc_event_signal ( kinc_event_t * event)

Signals an event which allows threads which are waiting for the event to continue.

Parameters
eventThe event to signal

◆ kinc_event_try_to_wait()

KINC_FUNC bool kinc_event_try_to_wait ( kinc_event_t * event,
double timeout )

Waits for an event to be signaled or the provided timeout to run out - whatever happens first.

Parameters
eventThe event to wait for
timeoutThe timeout in seconds after which the function returns if the event hasn't been signaled
Returns
Whether the event has been signaled

◆ kinc_event_wait()

KINC_FUNC void kinc_event_wait ( kinc_event_t * event)

Waits for an event to be signaled.

Parameters
eventThe event to wait for