--- pth_sync.c 2002/01/27 11:03:41 1.36
+++ pth_sync.c 2002/10/24 15:21:14 1.37
@@ -35,7 +35,7 @@
int pth_mutex_init(pth_mutex_t *mutex)
{
if (mutex == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
mutex->mx_state = PTH_MUTEX_INITIALIZED;
mutex->mx_owner = NULL;
mutex->mx_count = 0;
@@ -51,9 +51,9 @@
/* consistency checks */
if (mutex == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
if (!(mutex->mx_state & PTH_MUTEX_INITIALIZED))
- return_errno(FALSE, EDEADLK);
+ return pth_error(FALSE, EDEADLK);
/* still not locked, so simply acquire mutex? */
if (!(mutex->mx_state & PTH_MUTEX_LOCKED)) {
@@ -75,7 +75,7 @@
/* should we just tryonly? */
if (tryonly)
- return_errno(FALSE, EBUSY);
+ return pth_error(FALSE, EBUSY);
/* else wait for mutex to become unlocked.. */
pth_debug1("pth_mutex_acquire: wait until mutex is unlocked");
@@ -87,7 +87,7 @@
if (ev_extra != NULL) {
pth_event_isolate(ev);
if (!pth_event_occurred(ev))
- return_errno(FALSE, EINTR);
+ return pth_error(FALSE, EINTR);
}
if (!(mutex->mx_state & PTH_MUTEX_LOCKED))
break;
@@ -106,13 +106,13 @@
{
/* consistency checks */
if (mutex == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
if (!(mutex->mx_state & PTH_MUTEX_INITIALIZED))
- return_errno(FALSE, EDEADLK);
+ return pth_error(FALSE, EDEADLK);
if (!(mutex->mx_state & PTH_MUTEX_LOCKED))
- return_errno(FALSE, EDEADLK);
+ return pth_error(FALSE, EDEADLK);
if (mutex->mx_owner != pth_current)
- return_errno(FALSE, EACCES);
+ return pth_error(FALSE, EACCES);
/* decrement recursion counter and release mutex */
mutex->mx_count--;
@@ -149,7 +149,7 @@
int pth_rwlock_init(pth_rwlock_t *rwlock)
{
if (rwlock == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
rwlock->rw_state = PTH_RWLOCK_INITIALIZED;
rwlock->rw_readers = 0;
pth_mutex_init(&(rwlock->rw_mutex_rd));
@@ -161,9 +161,9 @@
{
/* consistency checks */
if (rwlock == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
if (!(rwlock->rw_state & PTH_RWLOCK_INITIALIZED))
- return_errno(FALSE, EDEADLK);
+ return pth_error(FALSE, EDEADLK);
/* acquire lock */
if (op == PTH_RWLOCK_RW) {
@@ -180,7 +180,7 @@
if (rwlock->rw_readers == 1) {
if (!pth_mutex_acquire(&(rwlock->rw_mutex_rw), tryonly, ev_extra)) {
rwlock->rw_readers--;
- errno_shield { pth_mutex_release(&(rwlock->rw_mutex_rd)); }
+ pth_shield { pth_mutex_release(&(rwlock->rw_mutex_rd)); }
return FALSE;
}
}
@@ -194,9 +194,9 @@
{
/* consistency checks */
if (rwlock == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
if (!(rwlock->rw_state & PTH_RWLOCK_INITIALIZED))
- return_errno(FALSE, EDEADLK);
+ return pth_error(FALSE, EDEADLK);
/* release lock */
if (rwlock->rw_mode == PTH_RWLOCK_RW) {
@@ -212,7 +212,7 @@
if (rwlock->rw_readers == 0) {
if (!pth_mutex_release(&(rwlock->rw_mutex_rw))) {
rwlock->rw_readers++;
- errno_shield { pth_mutex_release(&(rwlock->rw_mutex_rd)); }
+ pth_shield { pth_mutex_release(&(rwlock->rw_mutex_rd)); }
return FALSE;
}
}
@@ -229,7 +229,7 @@
int pth_cond_init(pth_cond_t *cond)
{
if (cond == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
cond->cn_state = PTH_COND_INITIALIZED;
cond->cn_waiters = 0;
return TRUE;
@@ -257,9 +257,9 @@
/* consistency checks */
if (cond == NULL || mutex == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
if (!(cond->cn_state & PTH_COND_INITIALIZED))
- return_errno(FALSE, EDEADLK);
+ return pth_error(FALSE, EDEADLK);
/* check whether we can do a short-circuit wait */
if ( (cond->cn_state & PTH_COND_SIGNALED)
@@ -302,9 +302,9 @@
{
/* consistency checks */
if (cond == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
if (!(cond->cn_state & PTH_COND_INITIALIZED))
- return_errno(FALSE, EDEADLK);
+ return pth_error(FALSE, EDEADLK);
/* do something only if there is at least one waiters (POSIX semantics) */
if (cond->cn_waiters > 0) {
@@ -331,7 +331,7 @@
int pth_barrier_init(pth_barrier_t *barrier, int threshold)
{
if (barrier == NULL || threshold <= 0)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
if (!pth_mutex_init(&(barrier->br_mutex)))
return FALSE;
if (!pth_cond_init(&(barrier->br_cond)))
@@ -349,9 +349,9 @@
int rv;
if (barrier == NULL)
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
if (!(barrier->br_state & PTH_BARRIER_INITIALIZED))
- return_errno(FALSE, EINVAL);
+ return pth_error(FALSE, EINVAL);
if (!pth_mutex_acquire(&(barrier->br_mutex), FALSE, NULL))
return FALSE;
|