criticalsection.h
Go to the documentation of this file.
#ifndef _VN_CRITICALSECTION_H_
#define _VN_CRITICALSECTION_H_
#include "vn/error.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
{
#if _WIN32
CRITICAL_SECTION handle;
#elif __linux__ || __APPLE__ || __CYGWIN__ || __QNXNTO__
pthread_mutex_t handle;
#else
#error "Unknown System"
#endif
} VnCriticalSection;
VnError VnCriticalSection_initialize(VnCriticalSection *criticalSection);
VnError VnCriticalSection_deinitialize(VnCriticalSection *criticalSection);
VnError VnCriticalSection_enter(VnCriticalSection *criticalSection);
VnError VnCriticalSection_leave(VnCriticalSection *criticalSection);
#ifdef __cplusplus
}
#endif
#endif
VnCriticalSection_leave
VnError VnCriticalSection_leave(VnCriticalSection *criticalSection)
Leave a critical section.
VnCriticalSection_initialize
VnError VnCriticalSection_initialize(VnCriticalSection *criticalSection)
VnCriticalSection_deinitialize
VnError VnCriticalSection_deinitialize(VnCriticalSection *criticalSection)
Disposes of a VnCriticalSection structure and associated resources.
VnCriticalSection
Definition: criticalsection.h:38
VnCriticalSection_enter
VnError VnCriticalSection_enter(VnCriticalSection *criticalSection)
Attempt to enter a critical section.