@@ -40,6 +40,9 @@ data Manager = Manager
40
40
, managerThreadPool :: WorkerList
41
41
}
42
42
43
+ instance Eq Manager where
44
+ (==) a b = managerHandles a == managerHandles b
45
+
43
46
type ManagerCompletionPort = FFI. IOCP (CompletionCallback () )
44
47
45
48
data HandleState = HandleState
@@ -76,8 +79,8 @@ managerRef = unsafePerformIO $
76
79
else newIORef Nothing
77
80
{-# NOINLINE managerRef #-}
78
81
79
- -- | Nifty trick to allow each 'IOCPHandle ' to allocate workers per concurrent
80
- -- task, while allowing all 'IOCPHandles' to share the thread pool as a whole.
82
+ -- | Nifty trick to allow each 'HandleState ' to allocate workers per concurrent
83
+ -- task, while allowing all 'HandleState's to share the thread pool as a whole.
81
84
newThreadPool :: IO WorkerList
82
85
newThreadPool = unsafeInterleaveIO $ do
83
86
w <- Worker. new
@@ -122,7 +125,7 @@ unregister Manager{..} key hstate = do
122
125
123
126
-- | Close the 'HANDLE' and unregister it from the I/O manager.
124
127
-- The callback is run in an exception 'mask', and should not use interruptible
125
- -- operations (e.g. 'takeMVar', 'threadDelay').
128
+ -- operations (e.g. 'takeMVar', 'threadDelay', 'System.IO.hClose' ).
126
129
closeHandleWith :: Manager -> (HANDLE -> IO () ) -> HANDLE -> IO ()
127
130
closeHandleWith Manager {.. } close h =
128
131
mask_ $ do
0 commit comments