view PrivateQueue.h @ 48:1ea30ca7093c

changed headers
author Sean Halle <seanhalle@yahoo.com>
date Tue, 23 Jul 2013 07:28:22 -0700
parents 8c0dcf6e15e6
children 083298a6f7b6
line source
1 /*
2 * Copyright 2009 OpenSourceResearchInstitute.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 */
8 #ifndef _PRIVATE_QUEUE_H
9 #define _PRIVATE_QUEUE_H
11 #include "PR__common_includes/PR__primitive_data_types.h"
13 #define TRUE 1
14 #define FALSE 0
16 #define LOCKED 1
17 #define UNLOCKED 0
20 /* It is the data that is shared so only need one mutex. */
21 typedef struct
22 { void **insertPos;
23 void **extractPos;
24 void **startOfData; //data is pointers
25 void **endOfData; //set when alloc data
26 }
27 PrivQueueStruc;
29 typedef void (*DynArrayFnPtr) ( void * ); //fn has to cast void *
31 PrivQueueStruc* makePrivQ ( );
32 bool32 isEmptyPrivQ ( PrivQueueStruc *Q ); //ret TRUE if empty
33 void* peekPrivQ ( PrivQueueStruc *Q ); //ret NULL if empty
34 void* readPrivQ ( PrivQueueStruc *Q ); //ret NULL if empty
35 void writePrivQ( void *in, PrivQueueStruc *Q );
36 //return false when full
37 bool32 writeIfSpacePrivQ( void * in, PrivQueueStruc* Q );
38 int32 numInPrivQ( PrivQueueStruc *Q );
39 void pushPrivQ( void * in, PrivQueueStruc* Q );
40 void freePrivQ( PrivQueueStruc *Q );
42 #endif /* _PRIVATE_QUEUE_H */