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: [email protected]
        ReportedBy: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to