*
* (c) sof, 2002-2003.
*/
+
+#if !defined(THREADED_RTS)
+
#include "Rts.h"
#include "RtsUtils.h"
#include <windows.h>
#include <stdio.h>
#include "Schedule.h"
-#include "RtsFlags.h"
#include "Capability.h"
#include "win32/AsyncIO.h"
#include "win32/IOManager.h"
}
void
-shutdownAsyncIO()
+shutdownAsyncIO(rtsBool wait_threads)
{
+ ShutdownIOManager(wait_threads);
if (completed_req_event != INVALID_HANDLE_VALUE) {
CloseHandle(completed_req_event);
completed_req_event = INVALID_HANDLE_VALUE;
CloseHandle(completed_table_sema);
completed_table_sema = NULL;
}
- ShutdownIOManager();
+ DeleteCriticalSection(&queue_lock);
}
/*
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) {
+ if (tso->what_next == ThreadRelocated) {
+ /* Drop the TSO from blocked_queue */
+ if (prev) {
+ setTSOLink(&MainCapability, prev, tso->_link);
+ } else {
+ blocked_queue_hd = tso->_link;
+ }
+ if (blocked_queue_tl == tso) {
+ blocked_queue_tl = prev ? prev : END_TSO_QUEUE;
+ }
+ continue;
+ }
+
switch(tso->why_blocked) {
case BlockedOnRead:
case BlockedOnWrite:
/* 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;
pushOnRunQueue(&MainCapability, tso);
break;
}
break;
}
+
+ prev = tso;
}
/* Signal that there's completed table slots available */
if ( !ReleaseSemaphore(completed_table_sema, 1, NULL) ) {
ResetEvent(abandon_req_wait);
}
+#endif /* !defined(THREADED_RTS) */