# HG changeset patch # User Sean Halle # Date 1362750008 28800 # Node ID 67c7f5a0308b60f9f6ba074ac27bab88a3bf03e0 # Parent d01d48b023cad85cbb0d6485209310f3ff43946e Renamed VMS to PR, in new branch diff -r d01d48b023ca -r 67c7f5a0308b BlockingQueue.c --- a/BlockingQueue.c Mon Sep 03 15:07:45 2012 -0700 +++ b/BlockingQueue.c Fri Mar 08 05:40:08 2013 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 2009 OpenSourceStewardshipFoundation.org + * Copyright 2009 OpenSourceResearchInstitute.org * Licensed under GNU General Public License version 2 * * Author: seanhalle@yahoo.com @@ -50,11 +50,11 @@ void* readCASQ( CASQueueStruc* Q ) { void *out = 0; - int tries = 0; + int32 tries = 0; void **startOfData = Q->startOfData; void **endOfData = Q->endOfData; - int gotLock = FALSE; + int32 gotLock = FALSE; while( TRUE ) { //this intrinsic returns true if the lock held "UNLOCKED", in which @@ -94,13 +94,13 @@ void writeCASQ( void * in, CASQueueStruc* Q ) { - int tries = 0; + int32 tries = 0; //TODO: need to make Q volatile? Want to do this Q in assembly! //Have no idea what GCC's going to do to this code void **startOfData = Q->startOfData; void **endOfData = Q->endOfData; - int gotLock = FALSE; + int32 gotLock = FALSE; while( TRUE ) { //this intrinsic returns true if the lock held "UNLOCKED", in which @@ -178,7 +178,7 @@ void* readSRSWQ( SRSWQueueStruc* Q ) { void *out = 0; - int tries = 0; + int32 tries = 0; while( TRUE ) { @@ -198,7 +198,7 @@ void* readSRSWQ_NonBlocking( SRSWQueueStruc* Q ) { void *out = 0; - int tries = 0; + int32 tries = 0; while( TRUE ) { @@ -218,7 +218,7 @@ void writeSRSWQ( void * in, SRSWQueueStruc* Q ) { - int tries = 0; + int32 tries = 0; while( TRUE ) { @@ -350,8 +350,8 @@ void* readSRMWQ( SRMWQueueStruc* Q ) { SRSWQueueStruc *readQ; void *readValue = 0; - int tries = 0; - int QToReadFrom = 0; + int32 tries = 0; + int32 QToReadFrom = 0; QToReadFrom = Q->lastQReadFrom; diff -r d01d48b023ca -r 67c7f5a0308b BlockingQueue.h --- a/BlockingQueue.h Mon Sep 03 15:07:45 2012 -0700 +++ b/BlockingQueue.h Fri Mar 08 05:40:08 2013 -0800 @@ -26,9 +26,9 @@ { pthread_mutex_t mutex_t; pthread_cond_t cond_w_t; pthread_cond_t cond_r_t; - int count; - int readPos; - int writePos; + int32 count; + int32 readPos; + int32 writePos; void* data[1024]; //an array of pointers int w_empty; int w_full; @@ -43,8 +43,8 @@ //========== CAS based queue ========== typedef struct - { volatile int insertLock; - volatile int extractLock; + { volatile int32 insertLock; + volatile int32 extractLock; volatile void* *insertPos; volatile void* *extractPos; void* startOfData[1024]; //data is pointers @@ -76,9 +76,9 @@ //========= non-atomic instr S R M W queue =========== typedef struct - { int lastQReadFrom; - int numInternalQs; - int internalQsSz; + { int32 lastQReadFrom; + int32 numInternalQs; + int32 internalQsSz; SRSWQueueStruc* *internalQs; } SRMWQueueStruc; diff -r d01d48b023ca -r 67c7f5a0308b PrivateQueue.c --- a/PrivateQueue.c Mon Sep 03 15:07:45 2012 -0700 +++ b/PrivateQueue.c Fri Mar 08 05:40:08 2013 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 2009 OpenSourceStewardshipFoundation.org + * Copyright 2009 OpenSourceResearchInstitute.org * Licensed under GNU General Public License version 2 * * NOTE: this version of SRSW correct as of April 25, 2010 @@ -40,6 +40,9 @@ } +/*A bit tricky, 'cause have to copy in two halves, and be careful about case + * when insert is at top and extract at bottom.. + */ void enlargePrivQ( PrivQueueStruc *Q ) { int32 oldSize, newSize, topPartSize, bottPartSize; @@ -283,10 +286,12 @@ } - void - freePrivQ( PrivQueueStruc *Q ) - { - //This free is not safe to use in wrapper lib nor app code! - PR_int__free( Q->startOfData ); - PR_int__free( Q ); - } \ No newline at end of file +/*NOTE: This free is not safe to use in wrapper lib nor app code + */ +void +freePrivQ( PrivQueueStruc *Q ) + { + //This free is not safe to use in wrapper lib nor app code! + PR_int__free( Q->startOfData ); + PR_int__free( Q ); + } diff -r d01d48b023ca -r 67c7f5a0308b PrivateQueue.h --- a/PrivateQueue.h Mon Sep 03 15:07:45 2012 -0700 +++ b/PrivateQueue.h Fri Mar 08 05:40:08 2013 -0800 @@ -1,5 +1,5 @@ /* - * Copyright 2009 OpenSourceStewardshipFoundation.org + * Copyright 2009 OpenSourceResearchInstitute.org * Licensed under GNU General Public License version 2 * * Author: seanhalle@yahoo.com