blob: 7bb8102a2d74302918697761c5488699d8754f97 (
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.Prim
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
|