Skip to content
Snippets Groups Projects
Commit e9ebea66 authored by Cheng Shao's avatar Cheng Shao Committed by Marge Bot
Browse files

ghc-internal: fix threadDelay for wasm in browsers

This commit fixes broken threadDelay for wasm when it runs in
browsers, see added note for detailed explanation.
parent 9ad0e2b4
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,11 @@ import GHC.Conc.Windows (asyncRead, asyncWrite, asyncDoProc, asyncReadBA,
import qualified GHC.Event.Thread as Event
#endif
#if defined(wasm32_HOST_ARCH)
import qualified GHC.Wasm.Prim.Conc as Wasm
import qualified GHC.Wasm.Prim.Flag as Wasm
#endif
ensureIOManagerIsRunning :: IO ()
#if defined(javascript_HOST_ARCH)
ensureIOManagerIsRunning = pure ()
......@@ -204,6 +209,8 @@ threadDelay time
#if defined(mingw32_HOST_OS)
| isWindowsNativeIO = Windows.threadDelay time
| threaded = Windows.threadDelay time
#elif defined(wasm32_HOST_ARCH)
| Wasm.isJSFFIUsed = Wasm.threadDelay time
#elif !defined(javascript_HOST_ARCH)
| threaded = Event.threadDelay time
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment