[svn-commits] russell: trunk r46994 - /trunk/include/asterisk/astobj.h

svn-commits at lists.digium.com svn-commits at lists.digium.com
Thu Nov 2 11:34:50 MST 2006


Author: russell
Date: Thu Nov  2 12:34:50 2006
New Revision: 46994

URL: http://svn.digium.com/view/asterisk?rev=46994&view=rev
Log:
Sure enough, some of the uses of astobj are doing recursive locking.  This
doesn't work with rwlocks, so, this is reverted for now.

Modified:
    trunk/include/asterisk/astobj.h

Modified: trunk/include/asterisk/astobj.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/astobj.h?rev=46994&r1=46993&r2=46994&view=diff
==============================================================================
--- trunk/include/asterisk/astobj.h (original)
+++ trunk/include/asterisk/astobj.h Thu Nov  2 12:34:50 2006
@@ -100,14 +100,14 @@
 
 /*! \brief Lock an ASTOBJ for reading.
  */
-#define ASTOBJ_RDLOCK(object) ast_rwlock_rdlock(&(object)->_lock)
+#define ASTOBJ_RDLOCK(object) ast_mutex_lock(&(object)->_lock)
 
 /*! \brief Lock an ASTOBJ for writing.
  */
-#define ASTOBJ_WRLOCK(object) ast_rwlock_wrlock(&(object)->_lock)
+#define ASTOBJ_WRLOCK(object) ast_mutex_lock(&(object)->_lock)
 
 /*! \brief Unlock a locked object. */
-#define ASTOBJ_UNLOCK(object) ast_rwlock_unlock(&(object)->_lock)
+#define ASTOBJ_UNLOCK(object) ast_mutex_unlock(&(object)->_lock)
 
 #ifdef ASTOBJ_CONTAINER_HASHMODEL 
 #define __ASTOBJ_HASH(type,hashes) \
@@ -124,7 +124,7 @@
  * \param hashes The number of containers the object can be present in.
  *
  * This macro adds components to a struct to make it an ASTOBJ.  This macro
- * differs from ASTOBJ_COMPONENTS_FULL in that it does not create a rwlock for
+ * differs from ASTOBJ_COMPONENTS_FULL in that it does not create a mutex for
  * locking.
  *
  * <b>Sample Usage:</b>
@@ -173,7 +173,7 @@
  */
 #define ASTOBJ_COMPONENTS(type) \
 	ASTOBJ_COMPONENTS_NOLOCK(type); \
-	ast_rwlock_t _lock; 
+	ast_mutex_t _lock; 
 	
 /*! \brief Add ASTOBJ components to a struct (with locking support).
  *
@@ -193,7 +193,7 @@
  */
 #define ASTOBJ_COMPONENTS_FULL(type,namelen,hashes) \
 	ASTOBJ_COMPONENTS_NOLOCK_FULL(type,namelen,hashes); \
-	ast_rwlock_t _lock; 
+	ast_mutex_t _lock; 
 
 /*! \brief Increment an object reference count.
  * \param object A pointer to the object to operate on.
@@ -226,7 +226,7 @@
 			ast_log(LOG_WARNING, "Unreferencing unreferenced (object)!\n"); \
 		ASTOBJ_UNLOCK(object); \
 		if (newcount == 0) { \
-			ast_rwlock_destroy(&(object)->_lock); \
+			ast_mutex_destroy(&(object)->_lock); \
 			destructor((object)); \
 		} \
 		(object) = NULL; \
@@ -264,7 +264,7 @@
  */
 #define ASTOBJ_INIT(object) \
 	do { \
-		ast_rwlock_init(&(object)->_lock); \
+		ast_mutex_init(&(object)->_lock); \
 		object->name[0] = '\0'; \
 		object->refcount = 1; \
 	} while(0)
@@ -274,14 +274,14 @@
 
 /*! \brief Lock an ASTOBJ_CONTAINER for reading.
  */
-#define ASTOBJ_CONTAINER_RDLOCK(container) ast_rwlock_rdlock(&(container)->_lock)
+#define ASTOBJ_CONTAINER_RDLOCK(container) ast_mutex_lock(&(container)->_lock)
 
 /*! \brief Lock an ASTOBJ_CONTAINER for writing. 
  */
-#define ASTOBJ_CONTAINER_WRLOCK(container) ast_rwlock_wrlock(&(container)->_lock)
+#define ASTOBJ_CONTAINER_WRLOCK(container) ast_mutex_lock(&(container)->_lock)
 
 /*! \brief Unlock an ASTOBJ_CONTAINER. */
-#define ASTOBJ_CONTAINER_UNLOCK(container) ast_rwlock_unlock(&(container)->_lock)
+#define ASTOBJ_CONTAINER_UNLOCK(container) ast_mutex_unlock(&(container)->_lock)
 
 #ifdef ASTOBJ_CONTAINER_HASHMODEL
 #error "Hash model for object containers not yet implemented!"
@@ -330,7 +330,7 @@
  */
 #define ASTOBJ_CONTAINER_INIT_FULL(container,hashes,buckets) \
 	do { \
-		ast_rwlock_init(&(container)->_lock); \
+		ast_mutex_init(&(container)->_lock); \
 	} while(0)
 	
 /*! \brief Destroy a container.
@@ -347,7 +347,7 @@
  */
 #define ASTOBJ_CONTAINER_DESTROY_FULL(container,hashes,buckets) \
 	do { \
-		ast_rwlock_destroy(&(container)->_lock); \
+		ast_mutex_destroy(&(container)->_lock); \
 	} while(0)
 
 /*! \brief Iterate through the objects in a container.
@@ -728,7 +728,7 @@
  * \endcode
  */
 #define ASTOBJ_CONTAINER_COMPONENTS(type) \
-	ast_rwlock_t _lock; \
+	ast_mutex_t _lock; \
 	ASTOBJ_CONTAINER_COMPONENTS_NOLOCK(type)
 
 /*! \brief Initialize a container.



More information about the svn-commits mailing list