projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 1998-01-08 18:03:08 by simonm]
[ghc-hetmet.git]
/
ghc
/
lib
/
ghc
/
IOHandle.lhs
diff --git
a/ghc/lib/ghc/IOHandle.lhs
b/ghc/lib/ghc/IOHandle.lhs
index
b0c3c81
..
a278781
100644
(file)
--- a/
ghc/lib/ghc/IOHandle.lhs
+++ b/
ghc/lib/ghc/IOHandle.lhs
@@
-58,15
+58,24
@@
readHandle :: Handle -> IO Handle__
writeHandle :: Handle -> Handle__ -> IO ()
#if defined(__CONCURRENT_HASKELL__)
writeHandle :: Handle -> Handle__ -> IO ()
#if defined(__CONCURRENT_HASKELL__)
-newHandle = newMVar
-readHandle = takeMVar
-writeHandle = putMVar
+
+-- Use MVars for concurrent Haskell
+newHandle hc = newMVar hc >>= \ h ->
+ return (Handle h)
+
+readHandle (Handle h) = takeMVar h
+writeHandle (Handle h) hc = putMVar h hc
+
#else
#else
-newHandle v = stToIO (newVar v)
-readHandle h = stToIO (readVar h)
-writeHandle h v = stToIO (writeVar h v)
-#endif
+-- Use ordinary MutableVars for non-concurrent Haskell
+newHandle hc = stToIO (newVar hc >>= \ h ->
+ return (Handle h))
+
+readHandle (Handle h) = stToIO (readVar h)
+writeHandle (Handle h) hc = stToIO (writeVar h hc)
+
+#endif
\end{code}
%*********************************************************
\end{code}
%*********************************************************
@@
-885,5
+894,4
@@
access of a closed file.
ioe_closedHandle :: Handle -> IO a
ioe_closedHandle h = fail (IOError (Just h) IllegalOperation "handle is closed")
ioe_closedHandle :: Handle -> IO a
ioe_closedHandle h = fail (IOError (Just h) IllegalOperation "handle is closed")
-
\end{code}
\end{code}