//myqueue.h
#ifndef __MYQUEUE_H__
#define __MYQUEUE_H__
 
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
 
#define TRUE 1
#define FALSE 0

#define MAXCNTBUF 1024*1
typedef struct sqlString
{
	int len;
	char buf[MAXCNTBUF];
}ElemType;   
 
typedef struct
{
	ElemType **rear;   
	ElemType *front;   
	int len;           
	int size;           
 
	pthread_mutex_t locker;    
	pthread_cond_t notEmpty;
	pthread_cond_t notFull;
}ArrQueue;     
 
 
 
ArrQueue *CreateQueue( int nLen)   ;     
void DestroyQueue( ArrQueue *pQueue );     
void ClearQueue( ArrQueue *pQueue );   
int GetLength( ArrQueue *pQueue );         
int GetSize( ArrQueue *pQueue );     
int IsEmpty( ArrQueue *pQueue );         
int GetHead( ArrQueue *pQueue, ElemType **pe );    
int EnQueue( ArrQueue *pQueue, ElemType *pe );       
int DeQueue( ArrQueue *pQueue, ElemType **pe ); 
void ForEachQueue( ArrQueue *pQueue, void (*func)(ElemType *pe) );  
#endif