diff options
Diffstat (limited to 'rts/win32/AsyncWinIO.c')
-rw-r--r-- | rts/win32/AsyncWinIO.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/rts/win32/AsyncWinIO.c b/rts/win32/AsyncWinIO.c index 70b4455c71..b625dcaf0a 100644 --- a/rts/win32/AsyncWinIO.c +++ b/rts/win32/AsyncWinIO.c @@ -387,25 +387,18 @@ void registerAlertableWait (bool has_timeout, DWORD mssec, uint64_t num_req, boo finished overlapped entried belonging to the completed I/O requests. The number of read entries will be returned in NUM. - We clear the outstanding request flag to prevent two threads from handling - the same payload early on. Failing this the final safe guard is in - processCompletions. */ + NOTE: This function isn't thread safe, but is intended to be called only + when requested by the I/O manager via notifyScheduler. In + that context it is thread safe as we're guaranteeing that the I/O + manager is blocked waiting for the read to happen followed by a + registerAlertableWait call. */ OVERLAPPED_ENTRY* getOverlappedEntries (uint32_t *num) { - AcquireSRWLockExclusive (&lock); - - if (outstanding_service_requests) - *num = num_last_completed; - else - *num = 0; - - outstanding_service_requests = false; - - ReleaseSRWLockExclusive (&lock); - + *num = num_last_completed; return entries; } + /* Called by the scheduler when we have ran out of work to do and we have at least one thread blocked on an I/O Port. When WAIT then if this function returns you will have at least one action to service, though this may be a |