summaryrefslogtreecommitdiff
path: root/rts/Threads.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-01-13 13:46:36 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-01-18 16:14:01 -0500
commit5a6efd218734dbb5c1350531680cd3f4177690f1 (patch)
tree6a989bc08406afba34acb3657edb49981420012c /rts/Threads.c
parent2d205154d3fd565c7f88e07c4c307f48c5ade902 (diff)
downloadhaskell-5a6efd218734dbb5c1350531680cd3f4177690f1.tar.gz
rts/winio: Fix #18382
Here we refactor WinIO's IO completion scheme, squashing a memory leak and fixing #18382. To fix #18382 we drop the special thread status introduced for IoPort blocking, BlockedOnIoCompletion, as well as drop the non-threaded RTS's special dead-lock detection logic (which is redundant to the GC's deadlock detection logic), as proposed in #20947. Previously WinIO relied on foreign import ccall "wrapper" to create an adjustor thunk which can be attached to the OVERLAPPED structure passed to the operating system. It would then use foreign import ccall "dynamic" to back out the original continuation from the adjustor. This roundtrip is significantly more expensive than the alternative, using a StablePtr. Furthermore, the implementation let the adjustor leak, meaning that every IO request would leak a page of memory. Fixes T18382.
Diffstat (limited to 'rts/Threads.c')
-rw-r--r--rts/Threads.c3
1 files changed, 0 insertions, 3 deletions
diff --git a/rts/Threads.c b/rts/Threads.c
index b9f753234f..ab7af2e52c 100644
--- a/rts/Threads.c
+++ b/rts/Threads.c
@@ -286,7 +286,6 @@ tryWakeupThread (Capability *cap, StgTSO *tso)
switch (tso->why_blocked)
{
- case BlockedOnIOCompletion:
case BlockedOnMVar:
case BlockedOnMVarRead:
{
@@ -888,8 +887,6 @@ printThreadBlockage(StgTSO *tso)
case BlockedOnMVarRead:
debugBelch("is blocked on atomic MVar read @ %p", tso->block_info.closure);
break;
- case BlockedOnIOCompletion:
- debugBelch("is blocked on I/O Completion port @ %p", tso->block_info.closure);
break;
case BlockedOnBlackHole:
debugBelch("is blocked on a black hole %p",