📄 queue.h
字号:
#ifndef QUEUE_H
#define QUEUE_H
#include <pthread.h>
typedef struct one_block
{
void * buf;
int len; //data length
} one_block;
typedef struct queue
{
struct one_block *block;
int size;
int head;
int tail;
pthread_mutex_t mMutex;
}queue;
typedef struct queue * QUE_handle;
typedef enum{ false=0, true=!false } bool;
#define LOCK(mutex) pthread_mutex_lock(&mutex);
#define UNLOCK(mutex) pthread_mutex_unlock(&mutex);
QUE_handle queue_init(int que_size, int one_buf_len);
bool queue_deinit(QUE_handle h);
bool enqueue(QUE_handle h, struct one_block * block );
bool dequeue( QUE_handle h, struct one_block * block);
#endif //QUEUE_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -