queue.h

来自「采集视频信号进行H264压缩并通过UDP传送」· C头文件 代码 · 共 36 行

H
36
字号
#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 + =
减小字号Ctrl + -
显示快捷键?