[svn-commits] gtjoseph: trunk r413103 - in /trunk: ./ include/asterisk/spinlock.h

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Apr 29 10:10:28 CDT 2014


Author: gtjoseph
Date: Tue Apr 29 10:10:24 2014
New Revision: 413103

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=413103
Log:
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

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/spinlock.h

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/include/asterisk/spinlock.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/spinlock.h?view=diff&rev=413103&r1=413102&r2=413103
==============================================================================
--- trunk/include/asterisk/spinlock.h (original)
+++ trunk/include/asterisk/spinlock.h Tue Apr 29 10:10:24 2014
@@ -95,6 +95,11 @@
 	__sync_lock_release(lock);
 	return 0;
 }
+
+static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
+{
+	return 0;
+}
 #endif
 
 /*!
@@ -143,6 +148,11 @@
 static force_inline int ast_spinlock_unlock(ast_spinlock_t *lock)
 {
 	x86chgl(lock, 0);
+	return 0;
+}
+
+static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
+{
 	return 0;
 }
 #endif
@@ -219,6 +229,11 @@
 		: "cc"
 	);
 
+	return 0;
+}
+
+static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
+{
 	return 0;
 }
 #endif
@@ -288,6 +303,11 @@
 
 	return 0;
 }
+
+static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
+{
+	return 0;
+}
 #endif
 
 /*!
@@ -321,6 +341,11 @@
 static force_inline int ast_spinlock_unlock(ast_spinlock_t *lock)
 {
 	return pthread_spin_unlock(lock);
+}
+
+static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
+{
+	return pthread_spin_destroy(lock);
 }
 #endif
 
@@ -361,6 +386,11 @@
 	OSSpinLockUnlock(lock);
 	return 0;
 }
+
+static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
+{
+	return 0;
+}
 #endif
 
 /*!
@@ -396,6 +426,11 @@
 {
 	return pthread_mutex_unlock(lock);
 }
+
+static force_inline int ast_spinlock_destroy(ast_spinlock_t *lock)
+{
+	return pthread_mutex_destroy(lock);
+}
 #endif
 
 #if !defined(AST_SPINLOCK_TYPE)
@@ -442,4 +477,12 @@
  */
 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 */




More information about the svn-commits mailing list