#include "hashStructure.h"
-#include "WaitingQueue.h"
+//#include "WaitingQueue.h"
#include "mlp_lock.h"
#include "mem.h"
newTable->array[i].tail=NULL;
}
- newTable->waitingQueue=mallocWaitingQueue(sizeofWaitingQueue);
+ // newTable->waitingQueue=mallocWaitingQueue(sizeofWaitingQueue);
return newTable;
}
if (bintail->type == WRITEBIN) {
TraverserData * td = &(((WriteBinItem_rcr *)bintail)->val);
//last one is to check for SESE blocks in a while loop.
- if(unlikely(td->resumePtr == ptr) && td->traverserID == traverserID && td->task == task) {
- return bintail->status;
+ if(unlikely(td->task == task)) {
+ be->head=val;
+ //return ready...this constraint is already handled
+ return READY;
}
} else if (bintail->type == READBIN) {
TraverserData * td = &((ReadBinItem_rcr *)bintail)->array[((ReadBinItem_rcr *)bintail)->index - 1];
- if(unlikely(td->resumePtr == ptr) && td->traverserID == traverserID) {
+ if(unlikely(td->task == task)) {
//if it matches, then we remove it and the code below will upgrade it to a write.
((ReadBinItem_rcr *)bintail)->index--;
bintail->total--;
//TODO write deletion/removal methods
-/*
-RETIREHASHTABLE(MemoryQueue *q, REntry *r) {
- Hashtable *T=r->hashtable;
- BinItem_rcr *b=r->binitem;
- RETIREBIN(T,r,b);
-}
-
-RETIREBIN(Hashtable *T, REntry *r, BinItem_rcr *b) {
- int key=generateKey( OBJPTRPTR_2_OBJOID( r->pointer ) );
+RETIREHASHTABLE(HashStructure *T, SESECommon *task, int key) {
+ BinItem_rcr *b=T->array[key].head;
if(isFineRead(r)) {
atomic_dec(&b->total);
}
val=(BinItem_rcr*)0x1;
val=(BinItem_rcr*)LOCKXCHG((unsigned INTPTR*)&(T->array[key]->head), (unsigned INTPTR)val);
} while(val==(BinItem_rcr*)0x1);
+
// at this point have locked bin
BinItem_rcr *ptr=val;
int haveread=FALSE;
T->array[key]->head=val; // release lock
}
}
-*/
+
/*
//Int will return success/fail. -1 indicates error (i.e. there's nothing there).
#define HASHSTRUCTURE_H_\r
\r
#include "mlp_runtime.h"\r
-#include "WaitingQueue.h"\r
+//#include "WaitingQueue.h"\r
\r
#define ITEM_NOT_AT_FRONT_OF_WAITINGQ 3\r
#define TRAVERSER_FINISHED 2\r
#define RNUMBINS 64\r
#define RNUMREAD 64\r
#define RNUMRENTRY 256\r
-#define RH_MASK (RNUMBINS<<4)-1\r
+#define RH_MASK (RNUMBINS)-1\r
\r
//Note: put resolved things at the end and unresolved at the front.\r
typedef struct BinItem_rcr {\r
\r
typedef struct Hashtable_rcr {\r
BinElement_rcr array[RNUMBINS];\r
- WaitingQueueBin * waitingQueue;\r
+ // WaitingQueueBin * waitingQueue;\r
} HashStructure;\r
\r
//Todo this is a clone of REntry, remove data fields as necessary\r