Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
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
Model registry
Operate
Terraform modules
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
Gesh
GHC
Commits
2f8df09e
Commit
2f8df09e
authored
25 years ago
by
Simon Marlow
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1999-08-25 16:39:14 by simonmar]
enable non-blocking I/O.
parent
5eb15889
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/lib/std/PrelHandle.lhs
+9
-17
9 additions, 17 deletions
ghc/lib/std/PrelHandle.lhs
with
9 additions
and
17 deletions
ghc/lib/std/PrelHandle.lhs
+
9
−
17
View file @
2f8df09e
...
...
@@ -222,11 +222,9 @@ stdout = unsafePerformIO (do
(0::Int){-writeable-} -- ConcHask: SAFE, won't block
#else
fo <- CCALL(openStdFile) (1::Int)
((1{-flush on close-}
{-
+ 128 don't block on I/O-})::Int)
((1{-flush on close-} + 128
{-
don't block on I/O-})::Int)
(0::Int){-writeable-} -- ConcHask: SAFE, won't block
#endif
-- NOTE: turn off non-blocking I/O until
-- we've got proper support for threadWait{Read,Write}
#ifndef __PARALLEL_HASKELL__
fo <- makeForeignObj fo
...
...
@@ -258,7 +256,7 @@ stdin = unsafePerformIO (do
(1::Int){-readable-} -- ConcHask: SAFE, won't block
#else
fo <- CCALL(openStdFile) (0::Int)
((0{-flush on close-}
{-
+ 128 don't block on I/O-})::Int)
((0{-flush on close-} + 128
{-
don't block on I/O-})::Int)
(1::Int){-readable-} -- ConcHask: SAFE, won't block
#endif
...
...
@@ -290,7 +288,7 @@ stderr = unsafePerformIO (do
(0::Int){-writeable-} -- ConcHask: SAFE, won't block
#else
fo <- CCALL(openStdFile) (2::Int)
((1{-flush on close-}
{-
+ 128 don't block on I/O-})::Int)
((1{-flush on close-} + 128
{-
don't block on I/O-})::Int)
(0::Int){-writeable-} -- ConcHask: SAFE, won't block
#endif
...
...
@@ -355,7 +353,7 @@ openFileEx f m = do
#else
-- See comment next to 'stderr' for why we leave
-- non-blocking off for now.
file_flags = file_flags'
{-
+ 128 Don't block on I/O
-}
file_flags = file_flags' + 128
--
Don't block on I/O
#endif
(file_flags', file_mode) =
...
...
@@ -1160,9 +1158,6 @@ mayBlock :: ForeignObj -> IO Int -> IO Int
mayBlock :: Addr -> IO Int -> IO Int
#endif
#ifndef notyet /*__CONCURRENT_HASKELL__*/
mayBlock _ act = act
#else
mayBlock fo act = do
rc <- act
case rc of
...
...
@@ -1186,18 +1181,15 @@ mayBlock fo act = do
CCALL(setConnNonBlockingIOFlag__) fo -- reset (connected) file object.
return rc
#endif
-- #ifdef __HUGS__
#if 1
threadDelay, threadWaitRead, threadWaitWrite :: Int -> IO ()
-- Hugs does actually have the primops needed to implement these
-- but
, like GHC,
the primops don't actually do anything...
threadDelay
_ = return (
)
threadWaitRead
_ = return (
)
threadWaitWrite
_ = return (
)
#endif
-- but the primops don't actually do anything...
threadDelay
(I# ms) = IO $ \s -> case delay# ms s of s -> (# s, () #
)
threadWaitRead
(I# fd) = IO $ \s -> case waitRead# fd s of s -> (# s, () #
)
threadWaitWrite
(I# fd) = IO $ \s -> case waitWrite# fd s of s -> (# s, () #
)
--
#endif
\end{code}
...
...
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