Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
dab0c2ed
Commit
dab0c2ed
authored
May 13, 2005
by
simonmar
Browse files
[project @ 2005-05-13 08:15:50 by simonmar]
make this test slightly more robust
parent
948e39c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
testsuite/tests/ghc-regress/concurrent/should_run/conc036.hs
View file @
dab0c2ed
module
Main
where
import
Control.Concurrent
import
Control.Exception
import
Prelude
hiding
(
catch
)
import
Foreign
import
System.IO
foreign
import
"sleep"
unsafe
sleepBlock
::
Int
->
IO
()
main
::
IO
()
main
=
do
newStablePtr
stdout
-- prevent stdout being finalized, sigh
th
<-
newEmptyMVar
forkIO
$
do
putStrLn
"newThread started"
sleepBlock
3
putStrLn
"newThread back again"
putMVar
th
"5 secs later"
threadDelay
1000000
>>
putStrLn
"mainThread"
sleepBlock
1
putMVar
th
"child"
threadDelay
500000
>>
putMVar
th
"main"
`
catch
`
\
_
->
return
()
-- tests that the other thread doing an unsafe call to
-- sleep(3) has blocked this thread. Not sure if this
-- is a useful test.
...
...
testsuite/tests/ghc-regress/concurrent/should_run/conc036.stdout
View file @
dab0c2ed
newThread started
newThread back again
mainThread
5 secs later
child
shutting down
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment