event.h
Go to the documentation of this file.
#ifndef _VNEVENT_H_
#define _VNEVENT_H_
#include "vn/int.h"
#include "vn/error.h"
#include "vn/bool.h"
#ifdef _WIN32
/* Disable some warnings for Visual Studio with -Wall. */
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4668)
#pragma warning(disable:4820)
#pragma warning(disable:4255)
#endif
#include <Windows.h>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#endif
#if (defined __linux__ || defined __APPLE__ || defined __CYGWIN__ || defined __QNXNTO__)
#include <pthread.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
#ifdef _WIN32
HANDLE handle;
#elif (defined __linux__ || defined __APPLE__ || defined __CYGWIN__ || defined __QNXNTO__)
pthread_mutex_t mutex;
pthread_cond_t condition;
bool isTriggered;
#else
#error "Unknown System"
#endif
} VnEvent;
VnError VnEvent_initialize(VnEvent *event);
VnError VnEvent_wait(VnEvent *event);
VnError VnEvent_waitUs(VnEvent *event, uint32_t timeoutUs);
VnError VnEvent_waitMs(VnEvent *event, uint32_t timeoutMs);
VnError VnEvent_signal(VnEvent *event);
#ifdef __cplusplus
}
#endif
#endif
VnEvent_signal
VnError VnEvent_signal(VnEvent *event)
Signals an event.
VnEvent_wait
VnError VnEvent_wait(VnEvent *event)
Causes the calling thread to wait on an event until the event is signalled.
VnEvent_waitMs
VnError VnEvent_waitMs(VnEvent *event, uint32_t timeoutMs)
Causes the calling thread to wait on an event until the event is signalled.
VnEvent
Structure representing an event.
Definition: event.h:41
VnEvent_initialize
VnError VnEvent_initialize(VnEvent *event)
Initializes a VnEvent structure.
VnEvent_waitUs
VnError VnEvent_waitUs(VnEvent *event, uint32_t timeoutUs)
Causes the calling thread to wait on an event until the event is signalled.