Skip to content
Snippets Groups Projects
Commit cf36ba7f authored by Cheng Shao's avatar Cheng Shao
Browse files

ghc-internal: add missing CPPs for wasm

This patch adds some missing CPP guards to ghc-internal, given those
functions are non existent on wasm and would cause linking issues.

(cherry picked from commit a998f69d)
parent e54e3335
No related branches found
No related tags found
No related merge requests found
......@@ -112,13 +112,21 @@ forkOS_entry stableAction = do
action <- deRefStablePtr stableAction
action
foreign import ccall forkOS_createThread
:: StablePtr (IO ()) -> IO CInt
failNonThreaded :: IO a
failNonThreaded = fail $ "RTS doesn't support multiple OS threads "
++"(use ghc -threaded when linking)"
#if defined(wasm32_HOST_ARCH)
forkOS _ = failNonThreaded
#else
foreign import ccall forkOS_createThread
:: StablePtr (IO ()) -> IO CInt
forkOS action0
| rtsSupportsBoundThreads = do
mv <- newEmptyMVar
......@@ -141,6 +149,7 @@ forkOS action0
freeStablePtr entry
return tid
| otherwise = failNonThreaded
#endif
-- | Like 'forkIOWithUnmask', but the child thread is a bound thread,
-- as with 'forkOS'.
......
......@@ -732,8 +732,13 @@ foreign import capi unsafe "HsBase.h read"
foreign import capi safe "HsBase.h read"
c_safe_read :: CInt -> Ptr Word8 -> CSize -> IO CSsize
#if !defined(HAVE_UMASK)
c_umask :: CMode -> IO CMode
c_umask _ = ioError (ioeSetLocation unsupportedOperation "umask")
#else
foreign import ccall unsafe "HsBase.h umask"
c_umask :: CMode -> IO CMode
#endif
-- See Note [Windows types]
foreign import capi unsafe "HsBase.h write"
......
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