重构
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
#ifndef INCLUDED_C_LOCKQUEUE_H
|
||||
#define INCLUDED_C_LOCKQUEUE_H
|
||||
|
||||
#ifndef INCLUDED_C_TYPES_H
|
||||
#include <c_Types.h>
|
||||
#endif /*INCLUDED_C_TYPES_H*/
|
||||
|
||||
#ifndef INCLUDED_C_MUTEX_H
|
||||
#include <c_Mutex.h>
|
||||
#endif /*INCLUDED_C_MUTEX_H*/
|
||||
|
||||
#ifndef INCLUDED_C_COND_H
|
||||
#include <c_Cond.h>
|
||||
#endif /*INCLUDED_C_COND_H*/
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
typedef struct {
|
||||
void** data;
|
||||
c_size_t capacity;
|
||||
c_size_t write_idx;
|
||||
c_size_t read_idx;
|
||||
c_size_t size;
|
||||
c_bool_t is_shutdown;
|
||||
|
||||
c_Mutex_t lock;
|
||||
c_Cond_t not_full;
|
||||
c_Cond_t not_empty;
|
||||
}c_LockQueue_t;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
c_err_t c_LockQueue_Init(c_LockQueue_t* queue, c_size_t capacity);
|
||||
void c_LockQueue_Destroy(c_LockQueue_t* queue);
|
||||
void c_LockQueue_Shutdown(c_LockQueue_t* queue);
|
||||
|
||||
c_err_t c_LockQueue_Push(c_LockQueue_t* queue, void* data);
|
||||
c_err_t c_LockQueue_Pop(c_LockQueue_t* queue, void** data);
|
||||
c_bool_t c_LockQueue_TimedPop(c_LockQueue_t* queue, void** item, c_uint_t timeout_ms);
|
||||
c_bool_t c_LockQueue_TimedPush(c_LockQueue_t* queue, void* item, c_uint_t timeout_ms);
|
||||
c_size_t c_LockQueue_Size(c_LockQueue_t* queue);
|
||||
|
||||
c_bool_t c_LockQueue_IsEmpty(c_LockQueue_t* queue);
|
||||
c_bool_t c_LockQueue_IsFull(c_LockQueue_t* queue);
|
||||
|
||||
#endif /*INCLUDED_C_LOCKQUEUE_H*/
|
||||
Reference in New Issue
Block a user