summaryrefslogtreecommitdiff
path: root/include/asterisk
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-10-28 16:33:09 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-10-28 16:33:09 +0000
commitce6b727c2c0f3258e19d0f1586bf2d339db899f2 (patch)
tree095de8a05879228b639f0e414e7bb7cf17cba0b1 /include/asterisk
parent79c08653386798c66b1a9639473f95997ce5244d (diff)
add macros for explicit module usecount increment/decrement
remove unnecessary locking around setting usecount to zero git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6876 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk')
-rwxr-xr-xinclude/asterisk/module.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/include/asterisk/module.h b/include/asterisk/module.h
index 52233886a..afb90ce24 100755
--- a/include/asterisk/module.h
+++ b/include/asterisk/module.h
@@ -290,6 +290,18 @@ void ast_unregister_atexit(void (*func)(void));
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 @@ void ast_unregister_atexit(void (*func)(void));
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