OK, I realize I may be doing something wrong, or otherwise someone would
have responded to the message below. Could anyone please enlighten me?
Have I broken some rules? I assure you if I did it was non intentional.
I have the highest appreciation for the ASF and for APR in particular.
Can someone please respond?
Ronen Mizrahi wrote:
Hi,
The function apr_proc_mutex_trylock(apr_proc_mutex_t *mutex) is
supposed to return APR_EBUSY if the mutex is already locked, however
it never does that. The following is taken from the SVN head:
*APR_DECLARE*(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t
*mutex)
{
DWORD rv;
rv = WaitForSingleObject(mutex->handle, 0);
*if* (rv == WAIT_OBJECT_0 || rv == WAIT_ABANDONED) {
*return* APR_SUCCESS;
}
*return* apr_get_os_error();
}
I suggest modifying it to (based on apr_thread_mutex_trylock()):
APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex)
{
DWORD rv;
rv = WaitForSingleObject(mutex->handle, 0);
if (rv == WAIT_OBJECT_0 || rv == WAIT_ABANDONED) {
return APR_SUCCESS;
}
return (rv == WAIT_TIMEOUT) ? APR_EBUSY : apr_get_os_error();
}
Please let me know if this is ok,
Ronen