avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/concurrent ReadWriteLock.java
Date Wed, 31 Oct 2001 13:56:34 GMT
bloritsch    01/10/31 05:56:34

  Modified:    src/java/org/apache/avalon/excalibur/concurrent
                        ReadWriteLock.java
  Log:
  Apply fix to ReadWriteLock fromAvi Drissman (drissman@acm.org)
  
  Revision  Changes    Path
  1.5       +11 -4     jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/concurrent/ReadWriteLock.java
  
  Index: ReadWriteLock.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/java/org/apache/avalon/excalibur/concurrent/ReadWriteLock.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ReadWriteLock.java	2001/08/10 17:12:52	1.4
  +++ ReadWriteLock.java	2001/10/31 13:56:34	1.5
  @@ -19,7 +19,7 @@
    * will take priority over those trying to get a read lock.
    *
    * @author <a href="mailto:leo.sutic@inspireinfrastructure.com">Leo Sutic</a>
  - * @version CVS $Revision: 1.4 $ $Date: 2001/08/10 17:12:52 $
  + * @version CVS $Revision: 1.5 $ $Date: 2001/10/31 13:56:34 $
    * @since 4.0
    */
   public class ReadWriteLock
  @@ -79,12 +79,19 @@
           synchronized ( m_lock )
           {
               m_numWaitingForWrite++;
  -            while ( m_numReadLocksHeld != 0 )
  +            try
               {
                   m_lock.wait();
  +                while ( m_numReadLocksHeld != 0 )
  +                {
  +                    m_lock.wait();
  +                }
  +                m_numReadLocksHeld = -1;
               }
  -            m_numReadLocksHeld = -1;
  -            m_numWaitingForWrite--;
  +            finally
  +            {
  +                m_numWaitingForWrite--;
  +            }
           }
       }
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message