You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2003/08/07 01:50:13 UTC

cvs commit: apr/locks/unix proc_mutex.c

wrowe       2003/08/06 16:50:13

  Modified:    locks/unix proc_mutex.c
  Log:
    Invert the order of marking the lock as released.  Since we first
    lock, then mark locked; instead mark as unlock (while the lock is
    still held) and then unlock.
  
    Serious change, this will mean that an unlock 'failure' will still
    set the unlocked flag.  This is consistent with the fact that the
    lock probably is not held or valid anymore, and certainly shouldn't
    be re-unlocked when destroyed.
  
  Revision  Changes    Path
  1.34      +5 -5      apr/locks/unix/proc_mutex.c
  
  Index: proc_mutex.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/unix/proc_mutex.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- proc_mutex.c	7 Jun 2003 19:45:10 -0000	1.33
  +++ proc_mutex.c	6 Aug 2003 23:50:13 -0000	1.34
  @@ -165,10 +165,10 @@
   {
       int rc;
   
  +    mutex->curr_locked = 0;
       if ((rc = sem_post((sem_t *)mutex->interproc->filedes)) < 0) {
           return errno;
       }
  -    mutex->curr_locked = 0;
       return APR_SUCCESS;
   }
   
  @@ -269,13 +269,13 @@
   {
       int rc;
   
  +    mutex->curr_locked = 0;
       do {
           rc = semop(mutex->interproc->filedes, &proc_mutex_op_off, 1);
       } while (rc < 0 && errno == EINTR);
       if (rc < 0) {
           return errno;
       }
  -    mutex->curr_locked = 0;
       return APR_SUCCESS;
   }
   
  @@ -434,13 +434,13 @@
   {
       apr_status_t rv;
   
  +    mutex->curr_locked = 0;
       if ((rv = pthread_mutex_unlock(mutex->pthread_interproc))) {
   #ifdef PTHREAD_SETS_ERRNO
           rv = errno;
   #endif
           return rv;
       }
  -    mutex->curr_locked = 0;
       return APR_SUCCESS;
   }
   
  @@ -553,13 +553,13 @@
   {
       int rc;
   
  +    mutex->curr_locked=0;
       do {
           rc = fcntl(mutex->interproc->filedes, F_SETLKW, &proc_mutex_unlock_it);
       } while (rc < 0 && errno == EINTR);
       if (rc < 0) {
           return errno;
       }
  -    mutex->curr_locked=0;
       return APR_SUCCESS;
   }
   
  @@ -661,13 +661,13 @@
   {
       int rc;
   
  +    mutex->curr_locked = 0;
       do {
           rc = flock(mutex->interproc->filedes, LOCK_UN);
       } while (rc < 0 && errno == EINTR);
       if (rc < 0) {
           return errno;
       }
  -    mutex->curr_locked = 0;
       return APR_SUCCESS;
   }