Skip to content

Commit c5acb41

Browse files
committed
threadWaitRead does not work on windows.
A fix was introduced in 243f01b The conditional was removed by mistake in 769ca47 To fix the regression the conditional will be reintroduced.
1 parent 51f123c commit c5acb41

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Hasql/Notifications.hs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@ module Hasql.Notifications
1717
FatalError (..),
1818
)
1919
where
20-
21-
import Control.Concurrent (threadDelay, threadWaitRead)
20+
#if defined(mingw32_HOST_OS)
21+
import Control.Concurrent ( threadDelay )
22+
#else
23+
import Control.Concurrent (threadWaitRead, threadDelay)
24+
#endif
2225
import Control.Exception (Exception, throw)
2326
import Control.Monad (forever, unless, void, when)
2427
import Data.ByteString.Char8 (ByteString)
@@ -190,9 +193,13 @@ waitForNotifications sendNotification con =
190193
mfd <- PQ.socket pqCon
191194
case mfd of
192195
Nothing -> void $ threadDelay 1000000
196+
#if defined(mingw32_HOST_OS)
197+
Just _ -> do
198+
void $ threadDelay 1000000
199+
#else
193200
Just fd -> do
194201
void $ threadWaitRead fd
195-
202+
#endif
196203
result <- PQ.consumeInput pqCon
197204
unless result $ do
198205
mError <- PQ.errorMessage pqCon

0 commit comments

Comments
 (0)