X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=rts%2Fwin32%2FAsyncIO.c;h=979df0cb272f649829144ef9759b6bbecda15142;hb=159fdb19228cfb04c3fd871ab3f41f8ef7984b58;hp=54fc5cb526c5ebe1d5e93a70caf101fee79319d5;hpb=e1cf7f788fe0e6ff984627641cfde2c17999de5d;p=ghc-hetmet.git diff --git a/rts/win32/AsyncIO.c b/rts/win32/AsyncIO.c index 54fc5cb..979df0c 100644 --- a/rts/win32/AsyncIO.c +++ b/rts/win32/AsyncIO.c @@ -12,7 +12,6 @@ #include #include #include "Schedule.h" -#include "RtsFlags.h" #include "Capability.h" #include "win32/AsyncIO.h" #include "win32/IOManager.h" @@ -275,9 +274,9 @@ start: unsigned int rID = completedTable[i].reqID; prev = NULL; - for(tso = blocked_queue_hd ; tso != END_TSO_QUEUE; prev = tso, tso = tso->link) { + for(tso = blocked_queue_hd ; tso != END_TSO_QUEUE; tso = tso->_link) { - switch(tso->why_blocked) { + switch(tso->why_blocked) { case BlockedOnRead: case BlockedOnWrite: case BlockedOnDoProc: @@ -290,17 +289,22 @@ start: /* Drop the matched TSO from blocked_queue */ if (prev) { - prev->link = tso->link; + setTSOLink(&MainCapability, prev, tso->_link); } else { - blocked_queue_hd = tso->link; + blocked_queue_hd = tso->_link; } if (blocked_queue_tl == tso) { blocked_queue_tl = prev ? prev : END_TSO_QUEUE; } /* Terminates the run queue + this inner for-loop. */ - tso->link = END_TSO_QUEUE; + tso->_link = END_TSO_QUEUE; tso->why_blocked = NotBlocked; + // save the StgAsyncIOResult in the + // stg_block_async_info stack frame, because + // the block_info field will be overwritten by + // pushOnRunQueue(). + tso->stackobj->sp[1] = (W_)tso->block_info.async_result; pushOnRunQueue(&MainCapability, tso); break; } @@ -311,6 +315,8 @@ start: } break; } + + prev = tso; } /* Signal that there's completed table slots available */ if ( !ReleaseSemaphore(completed_table_sema, 1, NULL) ) {