Commit 72aefc22 authored by Simon Marlow's avatar Simon Marlow
Browse files

add a test for #896

parent 8859bf9a
......@@ -10,3 +10,4 @@ def set_opts( opts ):
# opts.skip = 1
test('win32001', set_opts, compile_and_run, [''])
test('win32002', normal, compile_and_run, ['-package Win32'])
{-# OPTIONS_GHC -fffi #-}
-- Test that the Win32 error code from getLastError is thread-local.
import System.Win32
import Control.Monad
import Control.Concurrent
main = do
setLastError 42
r <- getLastError
when (r /= 42) $ fail ("wrong: " ++ show r)
m <- newEmptyMVar
forkIO $ do setLastError 43; putMVar m ()
takeMVar m
r <- getLastError
when (r /= 42) $ fail ("wrong: " ++ show r)
foreign import stdcall unsafe "windows.h SetLastError"
setLastError :: ErrCode -> IO ()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment