Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
1 Star 0 Fork 16

hacklinshell/queue

forked from 大橙子疯/queue
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (1)
master
master
Branches (1)
master
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (1)
master
queue
/
queue.h
queue
/
queue.h
queue.h 3.12 KB
Copy Edit Raw Blame History
大橙子疯 authored 2022年05月02日 17:01 +08:00 . ✨ feat: 增加不定长数据队列功能
/**
**********************************************************************************************************************
* @file queue.c
* @brief 该文件提供环形队列功能函数原型
* @author const_zpc any question please send mail to const_zpc@163.com
* @date 2022年05月02日
**********************************************************************************************************************
*
**********************************************************************************************************************
*/
/* Define to prevent recursive inclusion -----------------------------------------------------------------------------*/
#ifndef QUEUE_H
#define QUEUE_H
/* Includes ----------------------------------------------------------------------------------------------------------*/
#include <stdint.h>
#include <stdbool.h>
#ifndef NULL
#define NULL (void *)0
#endif
/* Exported types ----------------------------------------------------------------------------------------------------*/
typedef uint16_t queuesize_t;
/**
* @brief 队列操作信息结构体定义
*/
typedef struct{
volatile uint8_t state; /*!< 控制状态 */
queuesize_t end; /*!< 循环队列尾哨兵 */
queuesize_t head; /*!< 循环队列首哨兵 */
union
{
queuesize_t num; /*!< 循环队列中能存储的最多组数 */
queuesize_t virsize; /*!< Buf 内存基准大小 */
}un;
queuesize_t size; /*!< 单组内存大小 */
char *pBufMem; /*!< Buf 指针 */
} QueueCtrl_t;
/* Exported constants ------------------------------------------------------------------------------------------------*/
/* Exported macro ----------------------------------------------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------------------------------------------------*/
/**** 定长队列相关函数 *****/
extern QueueCtrl_t *Queue_Creat(queuesize_t queueNum, queuesize_t size, bool isCover);
extern void Queue_Destory(QueueCtrl_t *pCtrl);
extern int Queue_Init(QueueCtrl_t *pCtrl, const void *pBufMem, queuesize_t queueNum, queuesize_t size, bool isCover);
extern void *Queue_Request(QueueCtrl_t *pCtrl);
extern int Queue_Push(QueueCtrl_t *pCtrl, const void *src);
extern void *Queue_Front(QueueCtrl_t *pCtrl);
extern int Queue_Pop(QueueCtrl_t *pCtrl);
/**** 不定长队列相关函数 *****/
extern QueueCtrl_t *Queue_ArgCreat(queuesize_t size);
extern void Queue_ArgDestory(QueueCtrl_t *pCtrl);
extern int Queue_ArgInit(QueueCtrl_t *pCtrl, const void *pBufMem, queuesize_t size);
extern void *Queue_ArgRequest(QueueCtrl_t *pCtrl, queuesize_t size);
extern int Queue_ArgPush(QueueCtrl_t *pCtrl, const void *src, queuesize_t size);
extern void *Queue_ArgFront(QueueCtrl_t *pCtrl, queuesize_t *psize);
extern int Queue_ArgPop(QueueCtrl_t *pCtrl);
/**** 队列通用函数 *****/
extern bool Queue_IsEmpty(QueueCtrl_t *pCtrl);
extern void Queue_Clear(QueueCtrl_t *pCtrl);
#endif // !QUEUE_H
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

基于 C 语言实现的队列功能,扩展性强,同时支持零拷贝读写队列(适用于大内存的单个元素,可以有效减少函数耗时)
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/hacklinshell/queue.git
git@gitee.com:hacklinshell/queue.git
hacklinshell
queue
queue
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /