summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghci/should_run/T19733.hs
blob: 25ac106867cfecc4ab4f6edce51d2a5ca3b8bf2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{-# LANGUAGE MagicHash           #-}
{-# LANGUAGE UnboxedTuples       #-}
{-# LANGUAGE UnliftedFFITypes    #-}

{-# OPTIONS_GHC -fbyte-code      #-}

module Main where

import           GHC.Exts
import           GHC.IO
import           Foreign.C

main :: IO ()
main = testThreadId >> putStrLn "OK"

testThreadId :: IO CInt
testThreadId = IO $ \s0 ->
    case myThreadId# s0 of
        (# s1, tid #) -> (# s1, c_getThreadId tid #)

foreign import ccall unsafe "rts_getThreadId" c_getThreadId :: ThreadId# -> CInt