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] BufferedInputStream can not be closed in another thread (HARMONY-6014)
Date Mon, 17 Nov 2008 08:57:04 GMT
Regis wrote:
> I just read the spec, it doesn't say the read method is synchronized or
> thread-safe.

Agreed.  The class description doesn't say anything about multiple threads.

> I think BufferedInputStream just need to keep itself status consistent,
> he never know how is the InputStream implemented, it's better to left
> synchronous/asynchronous problems handled by the wrapped stream.

Well at the moment we have the methods on BufferedInputStream marked as
synchronized.  That will ensure the consistency of the state in the
buffered stream, and in the wrapped stream.

Relaxing the sync on close() would pass through the multi-threading
problems to the wrapped stream, but we still need to ensure the buffered
stream is consistent, and that is non-trivial too (see my patch on the
JIRA).

Regards,
Tim

Mime
View raw message