harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [classlib][luni] optimized InputStream reader (HARMONY-5522)
Date Mon, 17 Mar 2008 11:33:34 GMT
Alexei Fedotov wrote:
> As for [1], it seems the following should be done under synchronized
> (bais) {}. Imagine the thread will switch right after bais.pos check
> and someone will read few bytes from the stream. In this case only a
> part of the buffer should be returned.
> 
>         if (bais.pos == 0) {
>             bais.skip(bais.buf.length);
>             return bais.buf;
>         }
> 
> [1] http://issues.apache.org/jira/secure/attachment/12378007/ByteStream.java

Agreed.

Tim


Mime
View raw message