You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2004/04/30 16:41:52 UTC

DO NOT REPLY [Bug 28714] New: - apr_file_lock(!APR_FLOCK_NONBLOCK) never block on Windows9x

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28714>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28714

apr_file_lock(!APR_FLOCK_NONBLOCK) never block on Windows9x

           Summary: apr_file_lock(!APR_FLOCK_NONBLOCK) never block on
                    Windows9x
           Product: APR
           Version: HEAD
          Platform: PC
        OS/Version: Windows 9x
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: APR
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: inoue@ariel-networks.com


When we call apr_file_lock() without APR_FLOCK_NONBLOCK, it doesn't block even
if it can't acquire the lock.

Here is a workaround patch for apr/file_io/win32/flock.c,
 
@@ -74,8 +74,13 @@
             return apr_get_os_error();
     }
     else {
-        if (!LockFile(thefile->filehand, 0, 0, len, 0))
-            return apr_get_os_error();
+       /* On Win98/Me, LockFile() never block. So, take care of it. */
+        while (!LockFile(thefile->filehand, 0, 0, len, 0)) {
+           if ((type & APR_FLOCK_NONBLOCK) || GetLastError() != 33) {
+               return apr_get_os_error();
+           }
+           apr_sleep(1000);
+       }
     }
 
     return APR_SUCCESS;

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org