Commit 3565204c authored by sof's avatar sof
Browse files

[project @ 2003-09-11 00:39:04 by sof]

awaitRequests(): canonicalize removal of thread from blocked_queue
parent 7cbba64b
......@@ -194,7 +194,7 @@ start:
for (i=0; i < completed_hw; i++) {
unsigned int rID = completedTable[i].reqID;
prev = NULL;
for(tso = blocked_queue_hd ; tso != END_TSO_QUEUE; tso = tso->link) {
for(tso = blocked_queue_hd ; tso != END_TSO_QUEUE; prev = tso, tso = tso->link) {
switch(tso->why_blocked) {
case BlockedOnRead:
case BlockedOnWrite:
......@@ -207,14 +207,18 @@ start:
tso->block_info.async_result->errCode = completedTable[i].errCode;
/* Drop the matched TSO from blocked_queue */
if (prev) {
prev->link = tso->link;
if ( prev == NULL ) {
blocked_queue_hd = tso->link;
if (blocked_queue_tl == tso) {
blocked_queue_tl = END_TSO_QUEUE;
}
} else {
blocked_queue_hd = tso->link;
}
if (blocked_queue_tl == tso) {
blocked_queue_tl = prev;
prev->link = tso->link;
if (blocked_queue_tl == tso) {
blocked_queue_tl = END_TSO_QUEUE;
}
}
/* Terminates the run queue + this inner for-loop. */
tso->link = END_TSO_QUEUE;
tso->why_blocked = NotBlocked;
......@@ -228,7 +232,6 @@ start:
}
break;
}
prev = tso;
}
}
completed_hw = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment