Kore 3
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 <kore3/global.h>
#include <kore3/backend/event.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  kore_event

Typedefs

typedef struct kore_event kore_event

Functions

KORE_FUNC void kore_event_init (kore_event *event, bool auto_clear)
 Initializes an event-object.
KORE_FUNC void kore_event_destroy (kore_event *event)
 Destroys an event-object.
KORE_FUNC void kore_event_signal (kore_event *event)
 Signals an event which allows threads which are waiting for the event to continue.
KORE_FUNC void kore_event_wait (kore_event *event)
 Waits for an event to be signaled.
KORE_FUNC bool kore_event_try_to_wait (kore_event *event, double timeout)
 Waits for an event to be signaled or the provided timeout to run out - whatever happens first.
KORE_FUNC void kore_event_reset (kore_event *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

◆ kore_event_destroy()

KORE_FUNC void kore_event_destroy ( kore_event * event)

Destroys an event-object.

Parameters
eventThe event to destroy

◆ kore_event_init()

KORE_FUNC void kore_event_init ( kore_event * 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

◆ kore_event_reset()

KORE_FUNC void kore_event_reset ( kore_event * event)

Resets an event to an unsignaled state.

Parameters
eventThe event to reset

◆ kore_event_signal()

KORE_FUNC void kore_event_signal ( kore_event * event)

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

Parameters
eventThe event to signal

◆ kore_event_try_to_wait()

KORE_FUNC bool kore_event_try_to_wait ( kore_event * 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

◆ kore_event_wait()

KORE_FUNC void kore_event_wait ( kore_event * event)

Waits for an event to be signaled.

Parameters
eventThe event to wait for