diff --git a/rts/IOManager.c b/rts/IOManager.c index 377ba90bb44f3175f50e15ba3a05732852a0bfa3..ee110d34f9037d9812ed8cc5cf430ea9c7c573fc 100644 --- a/rts/IOManager.c +++ b/rts/IOManager.c @@ -41,12 +41,16 @@ #if defined(IOMGR_ENABLED_WIN32_LEGACY) #include "Threads.h" #include "win32/AsyncMIO.h" +#include "win32/AwaitEvent.h" #include "win32/MIOManager.h" #endif #if defined(IOMGR_ENABLED_WINIO) #include "win32/ThrIOManager.h" #include "win32/AsyncWinIO.h" +#if !defined(THREADED_RTS) +#include "win32/AwaitEvent.h" +#endif #endif #include <string.h> @@ -552,7 +556,7 @@ void pollCompletedTimeoutsOrIO(Capability *cap) switch (iomgr_type) { #if defined(IOMGR_ENABLED_SELECT) case IO_MANAGER_SELECT: - awaitEvent(cap, false); + awaitCompletedTimeoutsOrIOSelect(cap, false); break; #endif @@ -564,7 +568,7 @@ void pollCompletedTimeoutsOrIO(Capability *cap) #if defined(IOMGR_ENABLED_WINIO) case IO_MANAGER_WINIO: #endif - awaitEvent(cap, false); + awaitCompletedTimeoutsOrIOWin32(cap, false); break; #endif default: @@ -579,7 +583,7 @@ void awaitCompletedTimeoutsOrIO(Capability *cap) switch (iomgr_type) { #if defined(IOMGR_ENABLED_SELECT) case IO_MANAGER_SELECT: - awaitEvent(cap, true); + awaitCompletedTimeoutsOrIOSelect(cap, true); break; #endif @@ -591,7 +595,7 @@ void awaitCompletedTimeoutsOrIO(Capability *cap) #if defined(IOMGR_ENABLED_WINIO) case IO_MANAGER_WINIO: #endif - awaitEvent(cap, true); + awaitCompletedTimeoutsOrIOWin32(cap, true); break; #endif default: diff --git a/rts/IOManager.h b/rts/IOManager.h index 1be8c1f307d1dbd5e327d34235c0a22c62b98618..803960b0c23640a306340d70e6a70654ab3493e1 100644 --- a/rts/IOManager.h +++ b/rts/IOManager.h @@ -331,17 +331,4 @@ void pollCompletedTimeoutsOrIO(Capability *cap); */ void awaitCompletedTimeoutsOrIO(Capability *cap); -#if !defined(THREADED_RTS) -/* Check whether there is any completed I/O or expired timers. If so, - * process the competions as appropriate, which will typically cause some - * waiting threads to be woken up. - * - * Called from schedule() both *before* and *after* scheduleDetectDeadlock(). - * - * Defined in posix/Select.c - * or win32/AwaitEvent.c - */ -void awaitEvent(Capability *cap, bool wait); -#endif - #include "EndPrivate.h" diff --git a/rts/posix/Select.c b/rts/posix/Select.c index 848739a90429b7096afd901278fe530a40c70845..fb6e0337b6afb67af32ca99f45e09af8ea24f8c7 100644 --- a/rts/posix/Select.c +++ b/rts/posix/Select.c @@ -217,7 +217,7 @@ static enum FdState fdPollWriteState (int fd) * */ void -awaitEvent(Capability *cap, bool wait) +awaitCompletedTimeoutsOrIOSelect(Capability *cap, bool wait) { CapIOManager *iomgr = cap->iomgr; StgTSO *tso, *prev, *next; @@ -417,7 +417,7 @@ awaitEvent(Capability *cap, bool wait) } break; default: - barf("awaitEvent"); + barf("awaitCompletedTimeoutsOrIOSelect"); } switch (fd_state) { diff --git a/rts/posix/Select.h b/rts/posix/Select.h index ed2a9b34275956dc52c2362baa4520ed4da80613..498fddb4e09cd4fe3af437a0337ce3df1b3b72cc 100644 --- a/rts/posix/Select.h +++ b/rts/posix/Select.h @@ -12,3 +12,6 @@ typedef StgWord LowResTime; RTS_PRIVATE LowResTime getDelayTarget (HsInt us); + +void awaitCompletedTimeoutsOrIOSelect(Capability *cap, bool wait); + diff --git a/rts/win32/AwaitEvent.c b/rts/win32/AwaitEvent.c index fbe037c2a2ef0986c297dbbda9ec163ea6d9c328..d65537ea358cf7f20635928f55df24e4a5f0db6a 100644 --- a/rts/win32/AwaitEvent.c +++ b/rts/win32/AwaitEvent.c @@ -18,6 +18,7 @@ #include "Schedule.h" #include "IOManager.h" #include <windows.h> +#include "win32/AwaitEvent.h" #include "win32/AsyncMIO.h" #include "win32/AsyncWinIO.h" #include "win32/ConsoleHandler.h" @@ -28,7 +29,7 @@ static bool workerWaitingForRequests = false; void -awaitEvent(Capability *cap, bool wait) +awaitCompletedTimeoutsOrIOWin32(Capability *cap, bool wait) { do { /* Try to de-queue completed IO requests diff --git a/rts/win32/AwaitEvent.h b/rts/win32/AwaitEvent.h new file mode 100644 index 0000000000000000000000000000000000000000..b28c774f47c8832883b7d8b7c715dd3b4f5a6a2a --- /dev/null +++ b/rts/win32/AwaitEvent.h @@ -0,0 +1,4 @@ +#pragma once + +void awaitCompletedTimeoutsOrIOWin32(Capability *cap, bool wait); + diff --git a/rts/win32/ConsoleHandler.c b/rts/win32/ConsoleHandler.c index c54a798ccfcb1ced34e510ec49b81cfca4c25634..848d29288d8afcdf746c33d25539800e7b4c7724 100644 --- a/rts/win32/ConsoleHandler.c +++ b/rts/win32/ConsoleHandler.c @@ -230,7 +230,7 @@ static BOOL WINAPI generic_handler(DWORD dwCtrlType) stg_pending_buf[stg_pending_events] = dwCtrlType; stg_pending_events++; } - // we need to wake up awaitEvent() + // we need to wake up awaitCompletedTimeoutsOrIO() abandonRequestWait(); #endif return true;