Files
cAI/cKit/Foundation/c_Cond.h
T

33 lines
889 B
C
Raw Normal View History

2026-08-10 01:21:15 +08:00
#ifndef INCLUDED_C_COND_H
#define INCLUDED_C_COND_H
#ifndef INCLUDED_C_MUTEX_H
#include <c_Mutex.h>
#endif /*INCLUDED_C_MUTEX_H*/
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
typedef struct {
#if defined(PLATFORM_WINDOWS)
CONDITION_VARIABLE handle;
#elif defined(PLATFORM_POSIX)
pthread_cond_t handle;
#endif
c_bool_t is_initialized;
} c_Cond_t;
/* ------------------------------------------------------------------------------------------------------------------ */
/* */
c_err_t c_Cond_Init(c_Cond_t* cond);
void c_Cond_Destroy(c_Cond_t* cond);
void c_Cond_Wait(c_Cond_t* cond, c_Mutex_t* mutex);
c_bool_t c_Cond_TimedWait(c_Cond_t* cond, c_Mutex_t* mutex, c_uint_t timeout_ms);
void c_Cond_Signal(c_Cond_t* cond);
void c_Cond_Broadcast(c_Cond_t* cond);
#endif /*INCLUDED_C_COND_H*/