Skip to content

Commit

Permalink
Using the thread version of AutoUpdate for non-threaded RTS
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Dec 20, 2024
1 parent 0ae54c5 commit 96e53a8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
21 changes: 19 additions & 2 deletions auto-update/Control/AutoUpdate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,26 @@ module Control.AutoUpdate (
)
where

import Control.AutoUpdate.Types
#ifdef mingw32_HOST_OS
import Control.AutoUpdate.Thread
#else
import Control.AutoUpdate.Event
import qualified Control.AutoUpdate.Event as Event
import qualified Control.AutoUpdate.Thread as Thread

import GHC.Event

mkAutoUpdate :: UpdateSettings a -> IO (IO a)
mkAutoUpdate settings = do
mmgr <- getSystemEventManager
case mmgr of
Nothing -> Thread.mkAutoUpdate settings
Just _m -> Event.mkAutoUpdate settings

mkAutoUpdateWithModify :: UpdateSettings a -> (a -> IO a) -> IO (IO a)
mkAutoUpdateWithModify settings f = do
mmgr <- getSystemEventManager
case mmgr of
Nothing -> Thread.mkAutoUpdateWithModify settings f
Just _m -> Event.mkAutoUpdateWithModify settings f
#endif
import Control.AutoUpdate.Types
5 changes: 2 additions & 3 deletions auto-update/auto-update.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ library
Control.Reaper
Control.Reaper.Internal
other-modules: Control.AutoUpdate.Types
if os(windows)
other-modules: Control.AutoUpdate.Thread
else
Control.AutoUpdate.Thread
if !os(windows)
exposed-modules: Control.AutoUpdate.Internal
other-modules: Control.AutoUpdate.Event
build-depends: base >= 4.12 && < 5,
Expand Down

0 comments on commit 96e53a8

Please sign in to comment.