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=38410>.
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=38410

           Summary: apr/win32 misinterpreted the meaning of WAIT_ABANDONED
           Product: APR
           Version: 1.2.2
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


APR interpret WAIT_ABANDONED as equivalent to WAIT_OBJECT_0 and this is not
correct. See apr_proc_mutex_lock() and apr_proc_mutex_trylock().
According to doco from MS, WAIT_ABANDONED only means the ownership of the mutex
has been changed. The mutex is remain **non-signaled** (or becomes so if it was
signaled), i.e. while one thread get the return code WAIT_ABANDONED, it is
possible that another thread would get the mutex signaled instead. So we can't
simple return APR_SUCCESS as described in this notes in the CHANGES file:

  *) Win32: apr_proc_mutex_trylock and apr_proc_mutex_lock were
     incorrectly returning APR_BUSY if the lock was previously
     held by a thread that exited before releasing the lock
     (ie, if the process holding the lock segfaults). The MSDN
     doc says when WaitForSingleObject returns WAIT_ABANDONED,
     the calling thread takes ownership of the mutex, so these
     two routines should return APR_SUCCESS in this case, not
     APR_BUSY. [Bill Stoddard]

However, we shouldn't return APR_BUSY either.

The normal proper way to handle WAIT_ABANDONED is to put the
WaitForSingleObject() (or any other equivalent API) in a loop, e.g.:

    do {
        rc = WaitForSingleObject(mutex, INFINITE);
    } while (rc == WAIT_ABANDONED);

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to