"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "locks/os2/proc_mutex.c" between
apr-1.6.5.tar.bz2 and apr-1.7.0.tar.bz2

About: APR (Apache Portable Runtime) project offers software libraries that provide a predictable and consistent interface to underlying platform-specific implementations (APR core library).

proc_mutex.c  (apr-1.6.5.tar.bz2):proc_mutex.c  (apr-1.7.0.tar.bz2)
skipping to change at line 85 skipping to change at line 85
APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex,
const char *fname, const char *fname,
apr_lockmech_e mech, apr_lockmech_e mech,
apr_pool_t *pool) apr_pool_t *pool)
{ {
apr_proc_mutex_t *new; apr_proc_mutex_t *new;
ULONG rc; ULONG rc;
char *semname; char *semname;
if (mech != APR_LOCK_DEFAULT) { if (mech != APR_LOCK_DEFAULT && mech != APR_LOCK_DEFAULT_TIMED) {
return APR_ENOTIMPL; return APR_ENOTIMPL;
} }
new = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t)); new = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t));
new->pool = pool; new->pool = pool;
new->owner = 0; new->owner = 0;
new->lock_count = 0; new->lock_count = 0;
*mutex = new; *mutex = new;
semname = fixed_name(fname, pool); semname = fixed_name(fname, pool);
skipping to change at line 150 skipping to change at line 150
APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex) APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex)
{ {
ULONG rc = DosRequestMutexSem(mutex->hMutex, SEM_IMMEDIATE_RETURN); ULONG rc = DosRequestMutexSem(mutex->hMutex, SEM_IMMEDIATE_RETURN);
if (rc == 0) { if (rc == 0) {
mutex->owner = CurrentTid; mutex->owner = CurrentTid;
mutex->lock_count++; mutex->lock_count++;
} }
return APR_FROM_OS_ERROR(rc); return (rc == ERROR_TIMEOUT) ? APR_EBUSY : APR_FROM_OS_ERROR(rc);
}
APR_DECLARE(apr_status_t) apr_proc_mutex_timedlock(apr_proc_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));
}
if (rc == 0) {
mutex->owner = CurrentTid;
mutex->lock_count++;
}
return (rc == ERROR_TIMEOUT) ? APR_TIMEUP : APR_FROM_OS_ERROR(rc);
} }
APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex) APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex)
{ {
ULONG rc; ULONG rc;
if (mutex->owner == CurrentTid && mutex->lock_count > 0) { if (mutex->owner == CurrentTid && mutex->lock_count > 0) {
mutex->lock_count--; mutex->lock_count--;
rc = DosReleaseMutexSem(mutex->hMutex); rc = DosReleaseMutexSem(mutex->hMutex);
return APR_FROM_OS_ERROR(rc); return APR_FROM_OS_ERROR(rc);
skipping to change at line 227 skipping to change at line 247
APR_DECLARE(apr_status_t) apr_os_proc_mutex_put_ex(apr_proc_mutex_t **pmutex, APR_DECLARE(apr_status_t) apr_os_proc_mutex_put_ex(apr_proc_mutex_t **pmutex,
apr_os_proc_mutex_t *ospmutex, apr_os_proc_mutex_t *ospmutex,
apr_lockmech_e mech, apr_lockmech_e mech,
int register_cleanup, int register_cleanup,
apr_pool_t *pool) apr_pool_t *pool)
{ {
apr_proc_mutex_t *new; apr_proc_mutex_t *new;
if (pool == NULL) { if (pool == NULL) {
return APR_ENOPOOL; return APR_ENOPOOL;
} }
if (mech != APR_LOCK_DEFAULT) { if (mech != APR_LOCK_DEFAULT && mech != APR_LOCK_DEFAULT_TIMED) {
return APR_ENOTIMPL; return APR_ENOTIMPL;
} }
new = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t)); new = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t));
new->pool = pool; new->pool = pool;
new->owner = 0; new->owner = 0;
new->lock_count = 0; new->lock_count = 0;
new->hMutex = *ospmutex; new->hMutex = *ospmutex;
*pmutex = new; *pmutex = new;
 End of changes. 3 change blocks. 
3 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)