double_queue.h

来自「linux下一种双缓冲队列机制的实现源代码(C)。」· C头文件 代码 · 共 33 行

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