apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronen Mizrahi <ro...@tversity.com>
Subject Re: Possible bug in proc_mutex.c on Win32
Date Thu, 15 Sep 2005 19:24:05 GMT
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
>


Mime
View raw message