apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/file_io/win32 readwrite.c
Date Tue, 29 Oct 2002 21:13:54 GMT
wrowe       2002/10/29 13:13:54

  Modified:    file_io/win32 readwrite.c
  Log:
    Always lock the file on append, it's a good idea
  
  Revision  Changes    Path
  1.73      +5 -9      apr/file_io/win32/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/readwrite.c,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- readwrite.c	29 Oct 2002 12:15:19 -0000	1.72
  +++ readwrite.c	29 Oct 2002 21:13:54 -0000	1.73
  @@ -313,12 +313,10 @@
                    * that occasionally leads to deadlocked threads.
                    */
                   apr_thread_mutex_lock(thefile->mutex);
  -                if (!thefile->pOverlapped) {
  -                    rc = apr_file_lock(thefile, APR_FLOCK_EXCLUSIVE);
  -                    if (rc != APR_SUCCESS) {
  -                        apr_thread_mutex_unlock(thefile->mutex);
  -                        return rc;
  -                    }
  +                rc = apr_file_lock(thefile, APR_FLOCK_EXCLUSIVE);
  +                if (rc != APR_SUCCESS) {
  +                    apr_thread_mutex_unlock(thefile->mutex);
  +                    return rc;
                   }
                   rc = apr_file_seek(thefile, APR_END, &offset);
                   if (rc != APR_SUCCESS) {
  @@ -333,9 +331,7 @@
               rv = WriteFile(thefile->filehand, buf, *nbytes, &bwrote,
                              thefile->pOverlapped);
               if (thefile->append) {
  -                if (!thefile->pOverlapped) {
  -                    apr_file_unlock(thefile);
  -                }
  +                apr_file_unlock(thefile);
                   apr_thread_mutex_unlock(thefile->mutex);
               }
           }
  
  
  

Mime
View raw message