summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorTamar Christina <tamar@zhox.com>2020-10-06 09:55:19 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-10-09 08:49:33 -0400
commitc832f7e2a9314cfd61257cb161b1795b612d12b5 (patch)
tree7911a9046056fda84c01fef7d626ccba17f1aa4b /rts
parent9657f6f34a1a00008a0db935dbf25733cb483cd4 (diff)
downloadhaskell-c832f7e2a9314cfd61257cb161b1795b612d12b5.tar.gz
winio: fixed timeouts non-threaded.
Diffstat (limited to 'rts')
-rw-r--r--rts/win32/AsyncWinIO.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/rts/win32/AsyncWinIO.c b/rts/win32/AsyncWinIO.c
index 2af806b1c8..eebb0c77fb 100644
--- a/rts/win32/AsyncWinIO.c
+++ b/rts/win32/AsyncWinIO.c
@@ -203,9 +203,6 @@ static CONDITION_VARIABLE threadIOWait;
static uint32_t num_callbacks = 32;
/* Buffer for I/O request information. */
static OVERLAPPED_ENTRY *entries;
-/* Number of I/O calls verified to have completed in the last round by the
- Haskell I/O Manager. */
-static uint32_t num_last_completed;
/* Notify the Haskell side of this many new finished requests */
static uint32_t num_notify;
@@ -342,15 +339,15 @@ void registerAlertableWait (bool has_timeout, DWORD mssec, uint64_t num_req, boo
bool interrupt = false;
- if (num_req == 0 && !has_timeout) {
+ if (mssec == 0 && !has_timeout) {
timeout = INFINITE;
}
else if(has_timeout) {
timeout = mssec;
}
- outstanding_service_requests = pending_service;
+ outstanding_service_requests = false;
- //Resize queue if required
+ /* Resize queue if required. */
if (queue_full)
{
num_callbacks *= 2;
@@ -365,7 +362,7 @@ void registerAlertableWait (bool has_timeout, DWORD mssec, uint64_t num_req, boo
/* If the new timeout is earlier than the old one we have to reschedule the
wait. Do this by interrupting the current operation and setting the new
timeout, since it must be the shortest one in the queue. */
- if (timeout > mssec)
+ if (timeout > mssec && mssec > 0)
{
timeout = mssec;
interrupt = true;
@@ -373,9 +370,9 @@ void registerAlertableWait (bool has_timeout, DWORD mssec, uint64_t num_req, boo
ReleaseSRWLockExclusive (&wio_runner_lock);
- // Since we call registerAlertableWait only after
- // processing I/O requests it's always desireable to wake
- // up the runner here.
+ /* Since we call registerAlertableWait only after
+ processing I/O requests it's always desireable to wake
+ up the runner here. */
WakeConditionVariable (&wakeEvent);
if (interrupt) {
@@ -394,7 +391,7 @@ void registerAlertableWait (bool has_timeout, DWORD mssec, uint64_t num_req, boo
registerAlertableWait call. */
OVERLAPPED_ENTRY* getOverlappedEntries (uint32_t *num)
{
- *num = num_last_completed;
+ *num = num_notify;
return entries;
}
@@ -428,8 +425,8 @@ void awaitAsyncRequests (bool wait)
static void notifyScheduler(uint32_t num) {
AcquireSRWLockExclusive (&wio_runner_lock);
ASSERT(!canQueueIOThread);
- canQueueIOThread = true;
num_notify = num;
+ canQueueIOThread = true;
WakeConditionVariable(&threadIOWait);
ReleaseSRWLockExclusive (&wio_runner_lock);
}
@@ -454,7 +451,6 @@ bool queueIOThread()
if(canQueueIOThread)
{
ASSERT(!outstanding_service_requests);
- num_last_completed = num_notify;
outstanding_service_requests = true;
canQueueIOThread = false;
Capability *cap = &MainCapability;