This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: FYI: Minor BufferedWriter tweak


I noticed that BufferedWriter.localFlush is unnecessarily re-acquiring
the lock.  This patch removes the redundancy.  I'm checking it in.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* java/io/BufferedWriter.java (localFlush): Don't synchronize.

Index: java/io/BufferedWriter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/BufferedWriter.java,v
retrieving revision 1.7
diff -u -r1.7 BufferedWriter.java
--- java/io/BufferedWriter.java 2001/10/23 06:04:58 1.7
+++ java/io/BufferedWriter.java 2001/10/23 16:17:13
@@ -216,15 +216,13 @@
       }
   }
 
+  // This should only be called with the lock held.
   private final void localFlush () throws IOException
   {
     if (count > 0)
       {
-	synchronized (lock)
-	  {
-	    out.write(buffer, 0, count);
-	    count = 0;
-	  }
+	out.write(buffer, 0, count);
+	count = 0;
       }
   }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]