aboutsummaryrefslogtreecommitdiffstats
path: root/utils.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-02-21 00:19:14 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-02-21 00:19:14 +0000
commit5c161c3a8f48efea543766c756692854949d832c (patch)
tree49775a9a6ea0364f47b975ed791f8081d349e79a /utils.c
parent1d1a115108d8ae01a7b4f843b2631e479bb52fca (diff)
Fix random crashes when using the MeetMe application. This patch converts list
handling to use the linked list macros and most importantly, implements reference counting on the ast_conference objects. The reference counting was first backported from 1.4. However, that code has some problems that caused the reference count to never hit zero. Those problems are fixed in this patch and will be resolved in 1.4 and trunk next, with a different patch. (issues #7647, #9073, #9106, BE-115). git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@55750 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index 6b3680b8f..321f9113a 100644
--- a/utils.c
+++ b/utils.c
@@ -907,3 +907,14 @@ void ast_enable_packet_fragmentation(int sock)
#endif
}
+AST_MUTEX_DEFINE_STATIC(fetchadd_m); /* used for all fetc&add ops */
+
+int ast_atomic_fetchadd_int_slow(volatile int *p, int v)
+{
+ int ret;
+ ast_mutex_lock(&fetchadd_m);
+ ret = *p;
+ *p += v;
+ ast_mutex_unlock(&fetchadd_m);
+ return ret;
+}