⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 double_queue.h

📁 linux下一种双缓冲队列机制的实现源代码(C)。
💻 H
字号:
#ifndef DOUBLE_QUEUE_H
#define DOUBLE_QUEUE_H
#include "pro_packet.h"

struct RQueue_Node{
	char   *data;  /*mallo the memery for mail data*/
	struct RQueue_Node *next;  /*point to the next mail*/
};

struct Queue_Head{  /*the queue for store the whole mail data*/
	struct RQueue_Node    *Porigin;
	struct RQueue_Node    *Pcursor;
    int    Count;     /*the number of the data this queue have */
    int havedone;
	int    swapSignal;      /*1: to wake up the swap thread, it is initial to 0*/
	pthread_mutex_t QueueMutex;/*read and write mutex for queue accessing*/
	pthread_cond_t  QueueCond; /*the empty condition*/
     //  pthread_mutex_t Queue2Mutex;
    pthread_cond_t  SwapCond;  /*to swap*/

} ;
struct Queue_Head *pool_RQueue ;     //the queue for insert the mailnode
struct Queue_Head *process_RQueue ;  //the queue for insert the mailnode
struct Queue_Head * swapQueue  ;      //the queue for swap


extern pthread_mutex_t logmutex;

void Add_Mailqueue(char *data);
int init_mailqueue() ;

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -