thread_mutex.c (apr-1.6.5.tar.bz2) | : | thread_mutex.c (apr-1.7.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 63 | skipping to change at line 63 | |||
APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) | APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) | |||
{ | { | |||
ULONG rc = DosRequestMutexSem(mutex->hMutex, SEM_INDEFINITE_WAIT); | ULONG rc = DosRequestMutexSem(mutex->hMutex, SEM_INDEFINITE_WAIT); | |||
return APR_OS2_STATUS(rc); | return APR_OS2_STATUS(rc); | |||
} | } | |||
APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex) | APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex) | |||
{ | { | |||
ULONG rc = DosRequestMutexSem(mutex->hMutex, SEM_IMMEDIATE_RETURN); | ULONG rc = DosRequestMutexSem(mutex->hMutex, SEM_IMMEDIATE_RETURN); | |||
return APR_OS2_STATUS(rc); | ||||
return (rc == ERROR_TIMEOUT) ? APR_EBUSY : APR_FROM_OS_ERROR(rc); | ||||
} | ||||
APR_DECLARE(apr_status_t) apr_thread_mutex_timedlock(apr_thread_mutex_t *mutex, | ||||
apr_interval_time_t timeout) | ||||
{ | ||||
ULONG rc; | ||||
if (timeout <= 0) { | ||||
rc = DosRequestMutexSem(mutex->hMutex, SEM_IMMEDIATE_RETURN); | ||||
} | ||||
else { | ||||
rc = DosRequestMutexSem(mutex->hMutex, apr_time_as_msec(timeout)); | ||||
} | ||||
return (rc == ERROR_TIMEOUT) ? APR_TIMEUP : APR_FROM_OS_ERROR(rc); | ||||
} | } | |||
APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex) | APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex) | |||
{ | { | |||
ULONG rc = DosReleaseMutexSem(mutex->hMutex); | ULONG rc = DosReleaseMutexSem(mutex->hMutex); | |||
return APR_OS2_STATUS(rc); | return APR_OS2_STATUS(rc); | |||
} | } | |||
APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex) | APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex) | |||
{ | { | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 17 lines changed or added |