From 8023bad4ab76e88cb6f2ff5126f980535a1c51d7 Mon Sep 17 00:00:00 2001
From: Duncan Coutts <duncan@well-typed.com>
Date: Mon, 9 Jan 2023 18:14:03 +0000
Subject: [PATCH] waitRead# / waitWrite# do not work for win32-legacy I/O
 manager

Previously it was unclear that they did not work because the code path
was shared with other I/O managers (in particular select()).

Following the code carefully shows that what actually happens is that
the calling thread would block forever: the thread will be put into the
blocked queue, but no other action is scheduled that will ever result in
it getting unblocked.

It's better to just fail loudly in case anyone accidentally calls it,
also it's less confusing code.
---
 rts/IOManager.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/rts/IOManager.c b/rts/IOManager.c
index 0b7bd8556649..1e82e72e7428 100644
--- a/rts/IOManager.c
+++ b/rts/IOManager.c
@@ -724,16 +724,6 @@ void syncIOWaitReady(Capability   *cap,
             appendToIOBlockedQueue(cap, tso);
             break;
         }
-#endif
-#if defined(IOMGR_ENABLED_WIN32_LEGACY)
-        case IO_MANAGER_WIN32_LEGACY:
-        {
-            StgWord why_blocked = rw == IORead ? BlockedOnRead : BlockedOnWrite;
-            tso->block_info.fd = fd;
-            RELEASE_STORE(&tso->why_blocked, why_blocked);
-            appendToIOBlockedQueue(cap, tso);
-            break;
-        }
 #endif
         default:
             barf("waitRead# / waitWrite# not available for current I/O manager");
-- 
GitLab