2020-07-11 10:18:03 +08:00

42 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/******************************************************************************
* @brief ͨ<>ö<EFBFBD><C3B6>й<EFBFBD><D0B9><EFBFBD>
*
* Copyright (c) 2017~2020, <master_roger@sina.com>
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2017-03-19 Morro Initial version.
******************************************************************************/
#ifndef _QUEUE_H_
#define _QUEUE_H_
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
void *base; /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ*/
unsigned short element_size; /*<2A><><EFBFBD><EFBFBD>Ԫ<EFBFBD>ش<EFBFBD>С*/
unsigned short size; /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>*/
unsigned short front; /*<2A><><EFBFBD><EFBFBD>*/
unsigned short rear; /*<2A><>β*/
}queue_t;
bool queue_create(queue_t *q, void *container, int size, int element_size);
bool queue_peek (queue_t *q, void **element);
bool queue_put (queue_t *q, void *element);
bool queue_get (queue_t *q, void *element);
bool queue_del (queue_t *q);
void queue_clr (queue_t *q);
int queue_len (queue_t *q);
#ifdef __cplusplus
}
#endif
#endif