diff options
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | spin.c | 16 | 
2 files changed, 11 insertions, 10 deletions
@@ -1,3 +1,8 @@ +2001-10-08  Ross Johnson  <rpj@setup1.ise.canberra.edu.au> + +	* spin.c (pthread_spin_trylock): Was not returning +	EBUSY for multi CPU machines. +  2001-08-24  Ross Johnson  <rpj@setup1.ise.canberra.edu.au>  	* condvar.c (pthread_cond_destroy): Remove cv element @@ -284,17 +284,13 @@ pthread_spin_trylock(pthread_spinlock_t *lock)          }      } -  if ((_LONG) PTW32_SPIN_UNLOCKED == -      InterlockedCompareExchange((_LPLONG) &(s->interlock), -                                 (_LONG) PTW32_SPIN_LOCKED, -                                 (_LONG) PTW32_SPIN_UNLOCKED ) ) -    { -      return 0; -    } - -  if (s->interlock == PTW32_SPIN_USE_MUTEX) +  switch ((long) InterlockedCompareExchange((_LPLONG) &(s->interlock), +                                            (_LONG) PTW32_SPIN_LOCKED, +                                            (_LONG) PTW32_SPIN_UNLOCKED ))      { -      return pthread_mutex_trylock(&(s->u.mutex)); +      case PTW32_SPIN_UNLOCKED:  return 0; +      case PTW32_SPIN_LOCKED:    return EBUSY; +      case PTW32_SPIN_USE_MUTEX: return pthread_mutex_trylock(&(s->u.mutex));      }    return EINVAL;  | 
