summaryrefslogtreecommitdiff
path: root/ghc/rts/win32
diff options
context:
space:
mode:
authorsof <unknown>2003-09-11 00:39:04 +0000
committersof <unknown>2003-09-11 00:39:04 +0000
commit3565204cdbc2a97375c90a944d259c827e4a5ebc (patch)
treec115fbe3493f39f15b9599ce32dc362267c5614b /ghc/rts/win32
parent7cbba64b65967d947f5b028c80c0e2320376aabd (diff)
downloadhaskell-3565204cdbc2a97375c90a944d259c827e4a5ebc.tar.gz
[project @ 2003-09-11 00:39:04 by sof]
awaitRequests(): canonicalize removal of thread from blocked_queue
Diffstat (limited to 'ghc/rts/win32')
-rw-r--r--ghc/rts/win32/AsyncIO.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/ghc/rts/win32/AsyncIO.c b/ghc/rts/win32/AsyncIO.c
index bc153a9446..12de16ea75 100644
--- a/ghc/rts/win32/AsyncIO.c
+++ b/ghc/rts/win32/AsyncIO.c
@@ -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;