annotate PrivateQueue.h @ 41:8fcbe46de60a

bugfixes - peek and enlarge now working properly
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Wed, 19 Dec 2012 15:38:08 +0100
parents cb29e773f76f
children 179144f26c9d
rev   line source
Me@19 1 /*
Me@19 2 * Copyright 2009 OpenSourceStewardshipFoundation.org
Me@19 3 * Licensed under GNU General Public License version 2
Me@19 4 *
Me@19 5 * Author: seanhalle@yahoo.com
Me@19 6 */
Me@19 7
Me@19 8 #ifndef _PRIVATE_QUEUE_H
Me@19 9 #define _PRIVATE_QUEUE_H
Me@19 10
Me@20 11
seanhalle@28 12 #include "VMS_impl/VMS_primitive_data_types.h"
seanhalle@31 13 #include "VMS_impl/Services_Offered_by_VMS/Memory_Handling/vmalloc.h"
Me@20 14
Me@19 15
Me@19 16 #define TRUE 1
Me@19 17 #define FALSE 0
Me@19 18
Me@19 19 #define LOCKED 1
Me@19 20 #define UNLOCKED 0
Me@19 21
nengel@41 22 #define DEBUG_PRIVATE_Q
Me@19 23
Me@19 24 /* It is the data that is shared so only need one mutex. */
Me@19 25 typedef struct
Me@19 26 { void **insertPos;
Me@19 27 void **extractPos;
Me@19 28 void **startOfData; //data is pointers
Me@19 29 void **endOfData; //set when alloc data
nengel@41 30 #ifdef DEBUG_PRIVATE_Q
nengel@41 31 int numWrites;
nengel@41 32 int numReads;
nengel@41 33 #endif
Me@19 34 }
Me@19 35 PrivQueueStruc;
Me@19 36
Me@19 37 PrivQueueStruc* makePrivQ ( );
seanhalle@37 38 bool32 isEmptyPrivQ ( PrivQueueStruc *Q ); //ret TRUE if empty
seanhalle@37 39 void* peekPrivQ ( PrivQueueStruc *Q ); //ret NULL if empty
seanhalle@32 40 void* readPrivQ ( PrivQueueStruc *Q ); //ret NULL if empty
Me@19 41 void writePrivQ( void *in, PrivQueueStruc *Q );
seanhalle@32 42 //return false when full
seanhalle@32 43 bool32 writeIfSpacePrivQ( void * in, PrivQueueStruc* Q );
seanhalle@32 44 int32 numInPrivQ( PrivQueueStruc *Q );
seanhalle@32 45 void pushPrivQ( void * in, PrivQueueStruc* Q );
seanhalle@32 46 void freePrivQ( PrivQueueStruc *Q );
seanhalle@30 47
Me@19 48 #endif /* _PRIVATE_QUEUE_H */
Me@19 49