#ifndef INCLUDED_C_MUTEX_H #define INCLUDED_C_MUTEX_H #ifndef INCLUDED_C_BASE_H #include #endif /*INCLUDED_C_BASE_H*/ /* ------------------------------------------------------------------------------------------------------------------ */ /* */ #if defined(_WIN32) || defined(_WIN64) #define PLATFORM_WINDOWS 1 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif #include #else #define PLATFORM_POSIX 1 #include #endif /* ------------------------------------------------------------------------------------------------------------------ */ /* */ typedef struct { #if defined(PLATFORM_WINDOWS) CRITICAL_SECTION handle; #elif defined(PLATFORM_POSIX) pthread_mutex_t handle; #endif c_bool_t is_initialized; } c_Mutex_t; /* ------------------------------------------------------------------------------------------------------------------ */ /* */ c_err_t c_Mutex_Init(c_Mutex_t* mutex); void c_Mutex_Destroy(c_Mutex_t* mutex); void c_Mutex_Lock(c_Mutex_t* mutex); c_bool_t c_Mutex_TryLock(c_Mutex_t* mutex); void c_Mutex_UnLock(c_Mutex_t* mutex); #endif /*INCLUDED_C_MUTEX_H*/