view PrivateQueue.h @ 47:8c0dcf6e15e6

new branch -- PR_univ -- changed header to include PR__application.h
author Sean Halle <seanhalle@yahoo.com>
date Mon, 22 Jul 2013 07:05:57 -0700
parents 67c7f5a0308b
children 1ea30ca7093c
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
12 #include "PR__application_includes/PR__application.h"
15 #define TRUE 1
16 #define FALSE 0
18 #define LOCKED 1
19 #define UNLOCKED 0
22 /* It is the data that is shared so only need one mutex. */
23 typedef struct
24 { void **insertPos;
25 void **extractPos;
26 void **startOfData; //data is pointers
27 void **endOfData; //set when alloc data
28 }
29 PrivQueueStruc;
31 typedef void (*DynArrayFnPtr) ( void * ); //fn has to cast void *
33 PrivQueueStruc* makePrivQ ( );
34 bool32 isEmptyPrivQ ( PrivQueueStruc *Q ); //ret TRUE if empty
35 void* peekPrivQ ( PrivQueueStruc *Q ); //ret NULL if empty
36 void* readPrivQ ( PrivQueueStruc *Q ); //ret NULL if empty
37 void writePrivQ( void *in, PrivQueueStruc *Q );
38 //return false when full
39 bool32 writeIfSpacePrivQ( void * in, PrivQueueStruc* Q );
40 int32 numInPrivQ( PrivQueueStruc *Q );
41 void pushPrivQ( void * in, PrivQueueStruc* Q );
42 void freePrivQ( PrivQueueStruc *Q );
44 #endif /* _PRIVATE_QUEUE_H */