Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Glasgow Haskell Compiler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ara Adkins
Glasgow Haskell Compiler
Commits
63fecf0a
Commit
63fecf0a
authored
21 years ago
by
Simon Marlow
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 2004-04-20 15:52:18 by simonmar]
New version of fixIO which does eager blackholing.
parent
a5b43a2a
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libraries/base/System/IO.hs
+11
-2
11 additions, 2 deletions
libraries/base/System/IO.hs
with
11 additions
and
2 deletions
libraries/base/System/IO.hs
+
11
−
2
View file @
63fecf0a
...
@@ -375,8 +375,17 @@ hPrint hdl = hPutStrLn hdl . show
...
@@ -375,8 +375,17 @@ hPrint hdl = hPutStrLn hdl . show
-- fixIO
-- fixIO
#
ifdef
__GLASGOW_HASKELL__
#
ifdef
__GLASGOW_HASKELL__
fixIO
::
(
a
->
IO
a
)
->
IO
a
fixIO
::
(
a
->
IO
a
)
->
IO
a
fixIO
m
=
stToIO
(
fixST
(
ioToST
.
m
))
fixIO
k
=
do
ref
<-
newIORef
(
throw
NonTermination
)
ans
<-
unsafeInterleaveIO
(
readIORef
ref
)
result
<-
k
ans
writeIORef
ref
result
return
result
-- NOTE: we do our own explicit black holing here, because GHC's lazy
-- blackholing isn't enough. In an infinite loop, GHC may run the IO
-- computation a few times before it notices the loop, which is wrong.
#
endif
#
endif
-- $locking
-- $locking
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment