Given the sample:

    import std.algorithm, std.concurrency, std.stdio;


    void main()
    {
        enum bufferSize = 1;
        auto tid = spawn( &fileWriter );
        // Read loop
        /+ BUG: stdio can't handle the immutable buffer
        foreach( immutable(ubyte)[] buffer; stdin.byChunk( bufferSize ) )
            send( tid, buffer );
        +/
        foreach( const(ubyte)[] buffer; stdin.byChunk( bufferSize ) )
            send( tid, buffer );
    }


    void fileWriter()
    {
        // Write loop
        for( ; ; )
        {
            // BUG: stdio can't handle the immutable buffer
            //auto buffer = receiveOnly!(immutable(ubyte)[])();
            auto buffer = receiveOnly!(const(ubyte)[])();
            writeln( "rx: ", buffer.field[0] );
        }
    }

The output I see is:

        abacus:tdpl sean$ ch13_7
        aaaa
        rx: 10
        rx: 10
        rx: 10
        rx: 10
        rx: 10
        ^C
        abacus:tdpl sean$

Why if I send 4 'a' characters do I receive 5 \n characters?  Seems like the 
last character in the buffer is being copied over the preceding data.  I just 
thought I'd mention this in case someone has the time and inclination to look 
into it.
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to