[commit: ghc] master: Using unsafe foreign import for rtsSupportsBoundThreads (part of #9696) (1d6177b)

git at git.haskell.org git at git.haskell.org
Sat Mar 5 20:15:33 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1d6177b133f3a6ac28cc8a679807563cfca3c56a/ghc

>---------------------------------------------------------------

commit 1d6177b133f3a6ac28cc8a679807563cfca3c56a
Author: Marcin Mrotek <marcin.jan.mrotek at gmail.com>
Date:   Sat Mar 5 20:02:18 2016 +0100

    Using unsafe foreign import for rtsSupportsBoundThreads (part of #9696)
    
    A safe import is unnecessary considering rtsSupportsBoundThreads simply
    returns a constant.
    
    This commit doesn't fix the main issue of ticket #9696 that
    "readRawBufferPtr and writeRawBufferPtr allocate memory".
    
    Reviewers: bgamari, austin, hvr
    
    Reviewed By: hvr
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D1964
    
    GHC Trac Issues: #9696


>---------------------------------------------------------------

1d6177b133f3a6ac28cc8a679807563cfca3c56a
 libraries/base/Control/Concurrent.hs | 2 +-
 libraries/base/GHC/ConsoleHandler.hs | 2 +-
 libraries/base/GHC/IO/FD.hs          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libraries/base/Control/Concurrent.hs b/libraries/base/Control/Concurrent.hs
index e047662..535b2f0 100644
--- a/libraries/base/Control/Concurrent.hs
+++ b/libraries/base/Control/Concurrent.hs
@@ -253,7 +253,7 @@ waiting for the results in the main thread.
 -- If @rtsSupportsBoundThreads@ is 'False', 'isCurrentThreadBound'
 -- will always return 'False' and both 'forkOS' and 'runInBoundThread' will
 -- fail.
-foreign import ccall rtsSupportsBoundThreads :: Bool
+foreign import ccall unsafe rtsSupportsBoundThreads :: Bool
 
 
 {- |
diff --git a/libraries/base/GHC/ConsoleHandler.hs b/libraries/base/GHC/ConsoleHandler.hs
index 6d1e36f..8579c22 100644
--- a/libraries/base/GHC/ConsoleHandler.hs
+++ b/libraries/base/GHC/ConsoleHandler.hs
@@ -137,7 +137,7 @@ installHandler handler
 
    no_handler = errorWithoutStackTrace "win32ConsoleHandler"
 
-foreign import ccall "rtsSupportsBoundThreads" threaded :: Bool
+foreign import ccall unsafe "rtsSupportsBoundThreads" threaded :: Bool
 
 foreign import ccall unsafe "RtsExternal.h rts_InstallConsoleEvent"
   rts_installHandler :: CInt -> Ptr (StablePtr (CInt -> IO ())) -> IO CInt
diff --git a/libraries/base/GHC/IO/FD.hs b/libraries/base/GHC/IO/FD.hs
index eb7b80b..fb8a1d5 100644
--- a/libraries/base/GHC/IO/FD.hs
+++ b/libraries/base/GHC/IO/FD.hs
@@ -638,7 +638,7 @@ foreign import WINDOWS_CCONV safe "send"
 
 #endif
 
-foreign import ccall "rtsSupportsBoundThreads" threaded :: Bool
+foreign import ccall unsafe "rtsSupportsBoundThreads" threaded :: Bool
 
 -- -----------------------------------------------------------------------------
 -- utils



More information about the ghc-commits mailing list