mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-10 14:51:09 +00:00
Add "destroy" implementation for spinlock.
The original commit for spinlock was missing "destroy" implementations. Most of them are no-ops but phtread_spin and pthread_mutex do need their locks destroyed. ........ Merged revisions 413102 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@413103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -95,6 +95,11 @@ static force_inline int ast_spinlock_unlock(ast_spinlock_t *lock)
|
|||||||
__sync_lock_release(lock);
|
__sync_lock_release(lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -145,6 +150,11 @@ static force_inline int ast_spinlock_unlock(ast_spinlock_t *lock)
|
|||||||
x86chgl(lock, 0);
|
x86chgl(lock, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -221,6 +231,11 @@ static force_inline int ast_spinlock_unlock(ast_spinlock_t *lock)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -288,6 +303,11 @@ static force_inline int ast_spinlock_unlock(ast_spinlock_t *lock)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -322,6 +342,11 @@ static force_inline int ast_spinlock_unlock(ast_spinlock_t *lock)
|
|||||||
{
|
{
|
||||||
return pthread_spin_unlock(lock);
|
return pthread_spin_unlock(lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
|
||||||
|
{
|
||||||
|
return pthread_spin_destroy(lock);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -361,6 +386,11 @@ static force_inline int ast_spinlock_unlock(ast_spinlock_t *lock)
|
|||||||
OSSpinLockUnlock(lock);
|
OSSpinLockUnlock(lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -396,6 +426,11 @@ static force_inline int ast_spinlock_unlock(ast_spinlock_t *lock)
|
|||||||
{
|
{
|
||||||
return pthread_mutex_unlock(lock);
|
return pthread_mutex_unlock(lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
|
||||||
|
{
|
||||||
|
return pthread_mutex_destroy(lock);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(AST_SPINLOCK_TYPE)
|
#if !defined(AST_SPINLOCK_TYPE)
|
||||||
@@ -442,4 +477,12 @@ static force_inline int ast_spinlock_trylock(ast_spinlock_t *lock);
|
|||||||
*/
|
*/
|
||||||
static force_inline int ast_spinlock_unlock(ast_spinlock_t *lock);
|
static force_inline int ast_spinlock_unlock(ast_spinlock_t *lock);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Destroy a spin lock
|
||||||
|
* \param lock Address of the lock
|
||||||
|
* \retval 0 Success
|
||||||
|
* \retval other Failure
|
||||||
|
*/
|
||||||
|
static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock);
|
||||||
|
|
||||||
#endif /* _ASTERISK_SPINLOCK_H */
|
#endif /* _ASTERISK_SPINLOCK_H */
|
||||||
|
Reference in New Issue
Block a user