/*
 *  Copyright 2009 OpenSourceStewardshipFoundation.org
 *  Licensed under GNU General Public License version 2
 *
 * Author: seanhalle@yahoo.com
 */

#ifndef _PRIVATE_QUEUE_H
#define	_PRIVATE_QUEUE_H


#include "VMS_impl/VMS_primitive_data_types.h"
#include "VMS_impl/Services_Offered_by_VMS/Memory_Handling/vmalloc.h"


#define TRUE     1
#define FALSE    0

#define LOCKED   1
#define UNLOCKED 0


/* It is the data that is shared so only need one mutex. */
typedef struct
 { void      **insertPos;
   void      **extractPos;
   void      **startOfData;  //data is pointers
   void      **endOfData;    //set when alloc data
 }
PrivQueueStruc;

PrivQueueStruc*  makePrivQ ( );
bool32           isEmptyPrivQ ( PrivQueueStruc *Q ); //ret TRUE if empty
void*            peekPrivQ ( PrivQueueStruc *Q ); //ret NULL if empty
void*            readPrivQ ( PrivQueueStruc *Q ); //ret NULL if empty
void             writePrivQ( void *in, PrivQueueStruc *Q );
                    //return false when full
bool32           writeIfSpacePrivQ( void * in, PrivQueueStruc* Q );
int32            numInPrivQ( PrivQueueStruc *Q );
void             pushPrivQ( void * in, PrivQueueStruc* Q );
void             freePrivQ( PrivQueueStruc *Q );

#endif	/* _PRIVATE_QUEUE_H */

