comparison BlockingQueue.c @ 48:1ea30ca7093c

changed headers
author Sean Halle <seanhalle@yahoo.com>
date Tue, 23 Jul 2013 07:28:22 -0700
parents 67c7f5a0308b
children 083298a6f7b6
comparison
equal deleted inserted replaced
19:66886ded7002 20:8f75155fdbfa
12 #include <stdlib.h> 12 #include <stdlib.h>
13 #include <sched.h> 13 #include <sched.h>
14 #include <string.h> 14 #include <string.h>
15 15
16 #include "BlockingQueue.h" 16 #include "BlockingQueue.h"
17 #include "PR__common_includes/Services_offered_by_PR/Memory_Handling/vmalloc__wrapper_library.h"
17 18
18 #define INC(x) (++x == 1024) ? (x) = 0 : (x) 19 #define INC(x) (++x == 1024) ? (x) = 0 : (x)
19 20
20 #define SPINLOCK_TRIES 100000 21 #define SPINLOCK_TRIES 100000
21 22
171 } 172 }
172 173
173 void 174 void
174 freeSRSWQ( SRSWQueueStruc* Q ) 175 freeSRSWQ( SRSWQueueStruc* Q )
175 { 176 {
176 PR_int__free( Q ); 177 PR__free( Q );
177 } 178 }
178 179
179 void* readSRSWQ( SRSWQueueStruc* Q ) 180 void* readSRSWQ( SRSWQueueStruc* Q )
180 { void *out = 0; 181 { void *out = 0;
181 int32 tries = 0; 182 int32 tries = 0;
331 Q->internalQsSz *= 2; 332 Q->internalQsSz *= 2;
332 Q->internalQs = PR_WL__malloc( Q->internalQsSz * sizeof(SRSWQueueStruc *)); 333 Q->internalQs = PR_WL__malloc( Q->internalQsSz * sizeof(SRSWQueueStruc *));
333 for( i = 0; i < oldSz; i++ ) 334 for( i = 0; i < oldSz; i++ )
334 { Q->internalQs[i] = oldArray[i]; 335 { Q->internalQs[i] = oldArray[i];
335 } 336 }
336 PR_int__free( oldArray ); 337 PR__free( oldArray );
337 } 338 }
338 Q->internalQs[ Q->numInternalQs - 1 ] = makeSRSWQ(); 339 Q->internalQs[ Q->numInternalQs - 1 ] = makeSRSWQ();
339 return Q->numInternalQs - 1; 340 return Q->numInternalQs - 1;
340 } 341 }
341 342