Tom Tromey ([EMAIL PROTECTED]) wrote:
> The 1.2 docs are pretty clear on this:
> 
>     Reads up to len characters of data from this piped stream into an
>     array of characters. Less than len characters will be read if the end
>     of the data stream is reached. This method blocks until at least one
>     character of input is available.
> 
> I'm going to change Classpath to conform to this.

Yes. I think all we need to do is eliminate the try_not_to_block
functionality and make it the default.
 
> Aaron> My code is basically the GNU style, adopted to Java.  Other
> Aaron> people use their own styles which may not be the same.  I think
> Aaron> most people use Sun's gawdawful coding style.  Could you point
> Aaron> me at some synchronized blocks for examples?
> 
> Look at the first synchronized block in PipedReader:
> 
>   synchronized (lock) {
> 
>   src.connect(this);
> 
>   ever_connected = true;
> 
>   } // synchronized
> 
> I'll lazily fix these if there's no objection.

Ah. I think I know what happened here.  You can probably tell that I just
copied the InputStream oriented Piped functions when I wrote the Reader
oriented ones.  (A better implementation might have figured a way to
reuse the code there rather than copying).  Reader/Writer classes are
supposed to use the lock variable to synchronize access.  So I just deleted 
the synchronized keyword from the method decl and wrapped the whole body in 
a block, intending to go back later and fix it up, which I never did.  
Sorry about that.  Normally I would indent a sync block like so:

synchronized(lock)
  {
    foo();
  }
 
> There are other minor differences from the GNU style (as I understand
> it).  Mostly missing spaces.  Many GNU programs eschew () with return:
> "return foo;" and not "return (foo);", but I don't think this is
> canonized.
> 
> I have to admit I find the lack of indentation for functions
> offputting.  However, I know you like this.

I use vi as my editor, and /^methodName is just too convenient.  I
believe the GNU standards say that function names should begin in column 0
for just this reason.  I don't profess to be standards boy here, but I
personally like the general GNU indent style.  It's fairly economical
on horizonal space while still making the blocks of code easily visible.

-- 
Aaron M. Renn ([EMAIL PROTECTED]) http://www.urbanophile.com/arenn/

Reply via email to