projects
/
IRC.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ceb4450
)
make sure the other thread doesn't just fall asleep
author
bdemsky
<bdemsky>
Wed, 6 Aug 2008 05:42:03 +0000
(
05:42
+0000)
committer
bdemsky
<bdemsky>
Wed, 6 Aug 2008 05:42:03 +0000
(
05:42
+0000)
Robust/src/Runtime/DSTM/interface/queue.c
patch
|
blob
|
history
diff --git
a/Robust/src/Runtime/DSTM/interface/queue.c
b/Robust/src/Runtime/DSTM/interface/queue.c
index 9ff96430dbdcf305ef5f3072e62f0aed5a08378a..507cf65811da40fbf2619fead2e6338e6f098d90 100644
(file)
--- a/
Robust/src/Runtime/DSTM/interface/queue.c
+++ b/
Robust/src/Runtime/DSTM/interface/queue.c
@@
-25,17
+25,23
@@
void * getmemory(int size) {
if (tmpoffset>QSIZE) {
//Wait for tail to go past end
tmpoffset=size+sizeof(int);
if (tmpoffset>QSIZE) {
//Wait for tail to go past end
tmpoffset=size+sizeof(int);
- if (headoffset<tailoffset)
+ if (headoffset<tailoffset) {
+ pthread_cond_signal(&qcond);//wake the other thread up
return NULL;
return NULL;
+ }
//Wait for tail to go past new start
//Wait for tail to go past new start
- if (tailoffset<=tmpoffset)
+ if (tailoffset<=tmpoffset) {
+ pthread_cond_signal(&qcond);//wake the other thread up
return NULL;
return NULL;
+ }
*((int *)(memory+headoffset))=-1;//safe because we left space
*((int*)memory)=size+sizeof(int);
return memory+sizeof(int);
} else {
*((int *)(memory+headoffset))=-1;//safe because we left space
*((int*)memory)=size+sizeof(int);
return memory+sizeof(int);
} else {
- if (headoffset<tailoffset&&tailoffset<=tmpoffset)
+ if (headoffset<tailoffset&&tailoffset<=tmpoffset) {
+ pthread_cond_signal(&qcond);//wake the other thread up
return NULL;
return NULL;
+ }
*((int*)(memory+headoffset))=size+sizeof(int);
return memory+headoffset+sizeof(int);
}
*((int*)(memory+headoffset))=size+sizeof(int);
return memory+headoffset+sizeof(int);
}