Skip to content
  • Ben Gamari's avatar
    rts/winio: Fix #18382 · 5a6efd21
    Ben Gamari authored and Marge Bot's avatar Marge Bot committed
    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.
    5a6efd21