Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/Hasql/Notifications.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ module Hasql.Notifications
FatalError (..),
)
where

import Control.Concurrent (threadDelay, threadWaitRead)
#if defined(mingw32_HOST_OS)
import Control.Concurrent ( threadDelay )
#else
import Control.Concurrent (threadWaitRead, threadDelay)
#endif
import Control.Exception (Exception, throw)
import Control.Monad (forever, unless, void, when)
import Data.ByteString.Char8 (ByteString)
Expand Down Expand Up @@ -190,9 +193,13 @@ waitForNotifications sendNotification con =
mfd <- PQ.socket pqCon
case mfd of
Nothing -> void $ threadDelay 1000000
#if defined(mingw32_HOST_OS)
Just _ -> do
void $ threadDelay 1000000
#else
Just fd -> do
void $ threadWaitRead fd

#endif
result <- PQ.consumeInput pqCon
unless result $ do
mError <- PQ.errorMessage pqCon
Expand Down
Loading