Patch: fix ath_mutex_destroy

haypo at inl.fr haypo at inl.fr
Mon Jul 10 10:16:55 CEST 2006


Hi,

As Marcus Brinkmann asked, here is the patch against ath_mutex_destroy().

New function code:
======================== 8< ================================
int
ath_mutex_destroy (ath_mutex_t *lock)
{
  int err;
  if (!ops_set || !ops.mutex_destroy)
    return 0;

  /* if mutex isn't initialiased, just exit */
  (*ops.mutex_lock) (&check_init_lock);
  if (*lock == ATH_MUTEX_INITIALIZER) {
    (*ops.mutex_unlock) (&check_init_lock);
    return 0;
  }
  (*ops.mutex_unlock) (&check_init_lock);

  err = (*ops.mutex_destroy) (lock);
#ifndef NDEBUG
  assert (*lock == MUTEX_UNLOCKED);
  *lock = MUTEX_DESTROYED;
#endif
  return err;
}
======================== 8< ================================

Main change: if the lock is not initialized, just skip the function.

Victor Stinner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcrypt_ath_mutex_destroy.patch
Type: text/x-diff
Size: 839 bytes
Desc: not available
Url : /pipermail/attachments/20060710/3e785758/gcrypt_ath_mutex_destroy.bin


More information about the Gcrypt-devel mailing list