| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I/O library rewrite
-------------------
This commit replaces the old C/Haskell I/O implementation with a new
Haskell-only one using the new FFI & hsc2hs.
main points:
- lots of code deleted: we're about 3000 lines of C lighter,
but the amount of Haskell code is about the same.
- performance is ok: some operations are faster, others are
slower. There's still some tuning to do, though.
- the new library is designed to handle read/write streams
much better: a read/write stream gets a special kind of
handle internally called a "DuplexHandle", which actually
contains two separate handles, one for writing and one for
reading. The upshot is that you can do simultaneous reading
and writing to/from a socket or FIFO without any locking
problems. The effect is similar to calling socketToHandle
twice, except that finalization works properly (creating
two separate Handles could lead to the socket being closed
too early when one of the Handles is GC'd).
- hConnectTo and withHandleFor are gone (no one responded to
my mail on GHC users, but we can always bring 'em back if
necessary).
- I made a half-hearted attempt at keeping the system-specific
code in one place: see PrelPosix.hsc.
- I've rearranged the I/O tests and added lots more.
ghc/tests/lib/IO now contains Haskell 98-only IO tests,
ghc/test/lib/{IOExts, Directory, Time} now contain tests for
the relevant libraries. I haven't quite finished in here yet,
the IO tests work but the others don't yet.
- I haven't done anything about Unicode yet, but now we can
start to discuss what needs doing here. The new library
is using MutableByteArrays for its buffers because that
turned out to be a *lot* easier (and quicker) than malloc'd
buffers - I hope this won't cause trouble for unicode
translations though.
WARNING: Windows users refrain from updating until we've had a chance
to fix any issues that arise.
Testing: the basic H98 stuff has been pretty thoroughly tested, but
the new duplex handle stuff is still a little green.
|
|
|
|
| |
Correct an off-by-one error.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit fixes the trace/stderr problem, and also fixes some other
problems with the I/O library.
- handles now contain a list of free buffers, which are
guaranteed to be the same size as the primary handle buffer.
- hPutStr now doesn't evaluate any part of the input string with
the handle locked. Instead, it acquires a buffer from the handle
copies characters into it, then commits the buffer. This is
better for concurrency too, because the handle is only locked
while we're actually reading/writing, not while evaluating.
- there were an even number of off-by-one errors in the I/O system
which compensated for each other. This has been fixed.
- made the I/O subsystem a little more exception-safe. It still
isn't totally exception-safe, but I can't face doing that
without a complete rewrite of this thing in Haskell.
- add hPutBufFull and hGetBufFull. The compiler probably needs to
be updated to use these too.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Incremental cleanups & improvements to the I/O subsystem
- Initial fix for problems caused by partial writes
to non-blocking file descriptors. To see this bug,
run ghc/tests/programs/life_space_leak through a pipe.
- remove FILEOBJ_FLUSH, it allegedly has the same meaning
as FILEOBJ_WRITE. This fixes a buf in openFd: it erroneously didn't
set FILEOBJ_FLUSH on writeable file descriptors.
- some ANSIfication
|
|
|
|
| |
wibble
|
|
|
|
| |
wibble
|
|
|
|
| |
oops, committed wrong file
|
|
|
|
| |
ANSIfication
|
|
|
|
| |
updates
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Cleanup of non-blocking I/O
- file descriptors are now always set to non-blocking mode.
- we don't do an inputReady operation on descriptors before
attempting to read from them any more.
- the non-blocking flag on Handles has gone.
- the {set,clear}[Conn]NonBlockingFlag() functions have gone.
- the socket operations have been made to work properly with threads:
accept is now non-blocking (it does a threadWaitRead instead of
blocking), and the file descriptors returned by accept are set to
non-blocking mode.
Win32 will need some adjustments, no doubt.
|
|
|
|
| |
Winsock support
|
|
Beefed up IO stub functions to not have to rely on stdio any longer
|