[Asterisk-cvs] asterisk/include/asterisk module.h,1.24,1.25

kpfleming kpfleming
Fri Oct 28 12:40:33 CDT 2005


Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv812/include/asterisk

Modified Files:
	module.h 
Log Message:
add macros for explicit module usecount increment/decrement
remove unnecessary locking around setting usecount to zero


Index: module.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/module.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- module.h	26 Oct 2005 23:11:36 -0000	1.24
+++ module.h	28 Oct 2005 16:33:09 -0000	1.25
@@ -290,6 +290,18 @@
 						static struct localuser *localusers = NULL; \
 						static int localusecnt = 0;
 
+#define STANDARD_INCREMENT_USECOUNT \
+	ast_mutex_lock(&localuser_lock); \
+	localusecnt++; \
+	ast_mutex_unlock(&localuser_lock); \
+	ast_update_use_count();
+
+#define STANDARD_DECREMENT_USECOUNT \
+	ast_mutex_lock(&localuser_lock); \
+	localusecnt--; \
+	ast_mutex_unlock(&localuser_lock); \
+	ast_update_use_count();
+
 /*! 
  * \brief Add a localuser.
  * \param u a pointer to a localuser struct
@@ -375,16 +387,16 @@
 		u = u->next; \
 		free(ul); \
 	} \
-	ast_mutex_unlock(&localuser_lock); \
 	localusecnt=0; \
+	ast_mutex_unlock(&localuser_lock); \
+	ast_update_use_count(); \
 }
 
 /*!
  * \brief Set the specfied integer to the current usecount.
  * \param res the integer variable to set.
  *
- * This macro sets the specfied integer variable to the local usecount.  It
- * handles all the necessary thread synchronization.
+ * This macro sets the specfied integer variable to the local usecount.
  *
  * <b>Sample Usage:</b>
  * \code




More information about the svn-commits mailing list