Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit eebc207

Browse files
committedJan 24, 2025
Label internal Windows hack thread
1 parent 6e9c862 commit eebc207

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed
 

‎warp/Network/Wai/Handler/Warp/Windows.hs

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import Control.Concurrent
1010
import qualified Control.Exception
1111

1212
import Network.Wai.Handler.Warp.Imports
13+
import GHC.Conc (labelThread)
1314

1415
-- | Allow main socket listening thread to be interrupted on Windows platform
1516
--
@@ -18,7 +19,9 @@ windowsThreadBlockHack :: IO a -> IO a
1819
windowsThreadBlockHack act = do
1920
var <- newEmptyMVar :: IO (MVar (Either Control.Exception.SomeException a))
2021
-- Catch and rethrow even async exceptions, so don't bother with UnliftIO
21-
void . forkIO $ Control.Exception.try act >>= putMVar var
22+
void . forkIO $ do
23+
myThreadId >>= flip labelThread "Windows Thread Block Hack (warp)"
24+
Control.Exception.try act >>= putMVar var
2225
res <- takeMVar var
2326
case res of
2427
Left e -> Control.Exception.throwIO e

0 commit comments

Comments
 (0)
Please sign in to comment.