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: ...@@ -194,7 +194,7 @@ start:
for (i=0; i < completed_hw; i++) { for (i=0; i < completed_hw; i++) {
unsigned int rID = completedTable[i].reqID; unsigned int rID = completedTable[i].reqID;
prev = NULL; 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) { switch(tso->why_blocked) {
case BlockedOnRead: case BlockedOnRead:
case BlockedOnWrite: case BlockedOnWrite:
...@@ -207,14 +207,18 @@ start: ...@@ -207,14 +207,18 @@ start:
tso->block_info.async_result->errCode = completedTable[i].errCode; tso->block_info.async_result->errCode = completedTable[i].errCode;
/* Drop the matched TSO from blocked_queue */ /* Drop the matched TSO from blocked_queue */
if (prev) { if ( prev == NULL ) {
prev->link = tso->link; blocked_queue_hd = tso->link;
if (blocked_queue_tl == tso) {
blocked_queue_tl = END_TSO_QUEUE;
}
} else { } else {
blocked_queue_hd = tso->link; prev->link = tso->link;
} if (blocked_queue_tl == tso) {
if (blocked_queue_tl == tso) { blocked_queue_tl = END_TSO_QUEUE;
blocked_queue_tl = prev; }
} }
/* Terminates the run queue + this inner for-loop. */ /* Terminates the run queue + this inner for-loop. */
tso->link = END_TSO_QUEUE; tso->link = END_TSO_QUEUE;
tso->why_blocked = NotBlocked; tso->why_blocked = NotBlocked;
...@@ -228,7 +232,6 @@ start: ...@@ -228,7 +232,6 @@ start:
} }
break; break;
} }
prev = tso;
} }
} }
completed_hw = 0; 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