[asterisk-commits] murf: branch murf/mtxprof r122043 - in /team/murf/mtxprof: build_tools/ chann...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 12 01:08:54 CDT 2008


Author: murf
Date: Thu Jun 12 01:08:54 2008
New Revision: 122043

URL: http://svn.digium.com/view/asterisk?view=rev&rev=122043
Log:
OK, ready for testing. I've test-compiled the fixes with
various combinations of MTX_PROFILE, DEBUG_THREADS,
and DETECT_DEADLOCK. Looks good. Runtime tests
of "show profile" look good also.

The only thing I seem to have missed is
how to get the menuselect stuff to enforce
the conflict spec.


Modified:
    team/murf/mtxprof/build_tools/cflags-devmode.xml
    team/murf/mtxprof/channels/chan_local.c
    team/murf/mtxprof/channels/chan_mgcp.c
    team/murf/mtxprof/channels/chan_phone.c
    team/murf/mtxprof/channels/chan_unistim.c
    team/murf/mtxprof/funcs/func_lock.c
    team/murf/mtxprof/include/asterisk.h
    team/murf/mtxprof/include/asterisk/linkedlists.h
    team/murf/mtxprof/include/asterisk/lock.h
    team/murf/mtxprof/main/asterisk.c
    team/murf/mtxprof/main/astobj2.c
    team/murf/mtxprof/main/channel.c
    team/murf/mtxprof/main/pbx.c
    team/murf/mtxprof/pbx/pbx_config.c
    team/murf/mtxprof/res/res_smdi.c
    team/murf/mtxprof/utils/hashtest.c
    team/murf/mtxprof/utils/hashtest2.c
    team/murf/mtxprof/utils/refcounter.c

Modified: team/murf/mtxprof/build_tools/cflags-devmode.xml
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/build_tools/cflags-devmode.xml?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/build_tools/cflags-devmode.xml (original)
+++ team/murf/mtxprof/build_tools/cflags-devmode.xml Thu Jun 12 01:08:54 2008
@@ -1,5 +1,7 @@
 	<category name="MENUSELECT_CFLAGS" displayname="Compiler Flags - Development">
 		<member name="MTX_PROFILE" displayname="Enable Code Profiling Using TSC Counters">
+			<conflict>DETECT_DEADLOCKS</conflict>
+			<conflict>DEBUG_THREADS</conflict>
 		</member>
 		<member name="DEBUG_SCHEDULER" displayname="Enable Scheduler Debugging Output">
 		</member>

Modified: team/murf/mtxprof/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/channels/chan_local.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/channels/chan_local.c (original)
+++ team/murf/mtxprof/channels/chan_local.c Thu Jun 12 01:08:54 2008
@@ -801,11 +801,13 @@
 static int unload_module(void)
 {
 	struct local_pvt *p = NULL;
-
+	int lockret;
+	
 	/* First, take us out of the channel loop */
 	ast_cli_unregister_multiple(cli_local, sizeof(cli_local) / sizeof(struct ast_cli_entry));
 	ast_channel_unregister(&local_tech);
-	if (!AST_LIST_LOCK(&locals)) {
+	AST_LIST_LOCK_ASSIGN(&locals,lockret);
+	if (!lockret) {
 		/* Hangup all interfaces if they have an owner */
 		AST_LIST_TRAVERSE(&locals, p, list) {
 			if (p->owner)

Modified: team/murf/mtxprof/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/channels/chan_mgcp.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/channels/chan_mgcp.c (original)
+++ team/murf/mtxprof/channels/chan_mgcp.c Thu Jun 12 01:08:54 2008
@@ -3495,10 +3495,13 @@
 
 static int restart_monitor(void)
 {
+	int lockret;
+	
 	/* If we're supposed to be stopped -- stay stopped */
 	if (monitor_thread == AST_PTHREADT_STOP)
 		return 0;
-	if (ast_mutex_lock(&monlock)) {
+	ast_mutex_lock_assign(&monlock, lockret);
+	if (lockret) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
 		return -1;
 	}
@@ -4347,7 +4350,8 @@
 {
 	struct mgcp_endpoint *e;
 	struct mgcp_gateway *g;
-
+	int lockret;
+	
 	/* Check to see if we're reloading */
 	if (ast_mutex_trylock(&mgcp_reload_lock)) {
 		ast_log(LOG_WARNING, "MGCP is currently reloading.  Unable to remove module.\n");
@@ -4361,7 +4365,8 @@
 	ast_channel_unregister(&mgcp_tech);
 
 	/* Shut down the monitoring thread */
-	if (!ast_mutex_lock(&monlock)) {
+	ast_mutex_lock_assign(&monlock, lockret);
+	if (!lockret) {
 		if (monitor_thread && (monitor_thread != AST_PTHREADT_STOP)) {
 			pthread_cancel(monitor_thread);
 			pthread_kill(monitor_thread, SIGURG);
@@ -4377,8 +4382,9 @@
 		mgcp_reload(NULL, 0, NULL);
 		return -1;
 	}
-
-	if (!ast_mutex_lock(&gatelock)) {
+	
+	ast_mutex_lock_assign(&gatelock, lockret);
+	if (!lockret) {
 		for (g = gateways; g; g = g->next) {
 			g->delme = 1;
 			for (e = g->endpoints; e; e = e->next)

Modified: team/murf/mtxprof/channels/chan_phone.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/channels/chan_phone.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/channels/chan_phone.c (original)
+++ team/murf/mtxprof/channels/chan_phone.c Thu Jun 12 01:08:54 2008
@@ -1022,10 +1022,12 @@
 	/* This thread monitors all the frame relay interfaces which are not yet in use
 	   (and thus do not have a separate thread) indefinitely */
 	while (monitor) {
+		int lockret;
 		/* Don't let anybody kill us right away.  Nobody should lock the interface list
 		   and wait for the monitor list, but the other way around is okay. */
 		/* Lock the interface list */
-		if (ast_mutex_lock(&iflock)) {
+		ast_mutex_lock_assign(&iflock, lockret);
+		if (lockret) {
 			ast_log(LOG_ERROR, "Unable to grab interface lock\n");
 			return NULL;
 		}
@@ -1088,7 +1090,8 @@
 			continue;
 		/* Alright, lock the interface list again, and let's look and see what has
 		   happened */
-		if (ast_mutex_lock(&iflock)) {
+		ast_mutex_lock_assign(&iflock, lockret);
+		if (lockret) {
 			ast_log(LOG_WARNING, "Unable to lock the interface list\n");
 			continue;
 		}
@@ -1116,10 +1119,12 @@
 
 static int restart_monitor()
 {
+	int lockret;
 	/* If we're supposed to be stopped -- stay stopped */
 	if (monitor_thread == AST_PTHREADT_STOP)
 		return 0;
-	if (ast_mutex_lock(&monlock)) {
+	ast_mutex_lock_assign(&monlock, lockret);
+	if (lockret) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
 		return -1;
 	}
@@ -1129,7 +1134,8 @@
 		return -1;
 	}
 	if (monitor_thread != AST_PTHREADT_NULL) {
-		if (ast_mutex_lock(&iflock)) {
+		ast_mutex_lock_assign(&iflock, lockret);
+		if (lockret) {
 			ast_mutex_unlock(&monlock);
 			ast_log(LOG_WARNING, "Unable to lock the interface list\n");
 			return -1;
@@ -1218,9 +1224,10 @@
 	struct phone_pvt *p;
 	struct ast_channel *tmp = NULL;
 	char *name = data;
-
+	int lockret;
 	/* Search for an unowned channel */
-	if (ast_mutex_lock(&iflock)) {
+	ast_mutex_lock_assign(&iflock, lockret);
+	if (lockret) {
 		ast_log(LOG_ERROR, "Unable to lock interface list???\n");
 		return NULL;
 	}
@@ -1279,10 +1286,12 @@
 static int __unload_module(void)
 {
 	struct phone_pvt *p, *pl;
+	int lockret;
 	/* First, take us out of the channel loop */
 	if (cur_tech)
 		ast_channel_unregister(cur_tech);
-	if (!ast_mutex_lock(&iflock)) {
+	ast_mutex_lock_assign(&iflock, lockret);
+	if (!lockret) {
 		/* Hangup all interfaces if they have an owner */
 		p = iflist;
 		while(p) {
@@ -1296,7 +1305,8 @@
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
 		return -1;
 	}
-	if (!ast_mutex_lock(&monlock)) {
+	ast_mutex_lock_assign(&monlock, lockret);
+	if (!lockret) {
 		if (monitor_thread > AST_PTHREADT_NULL) {
 			monitor = 0;
 			while (pthread_kill(monitor_thread, SIGURG) == 0)
@@ -1310,7 +1320,8 @@
 		return -1;
 	}
 
-	if (!ast_mutex_lock(&iflock)) {
+	ast_mutex_lock_assign(&iflock, lockret);
+	if (!lockret) {
 		/* Destroy all the interfaces and free their memory */
 		p = iflist;
 		while(p) {
@@ -1345,7 +1356,8 @@
 	int mode = MODE_IMMEDIATE;
 	int txgain = DEFAULT_GAIN, rxgain = DEFAULT_GAIN; /* default gain 1.0 */
 	struct ast_flags config_flags = { 0 };
-
+	int lockret;
+	
 	cfg = ast_config_load(config, config_flags);
 
 	/* We *must* have a config file otherwise stop immediately */
@@ -1353,7 +1365,8 @@
 		ast_log(LOG_ERROR, "Unable to load config %s\n", config);
 		return AST_MODULE_LOAD_DECLINE;
 	}
-	if (ast_mutex_lock(&iflock)) {
+	ast_mutex_lock_assign(&iflock, lockret);
+	if (lockret) {
 		/* It's a little silly to lock it, but we mind as well just to be sure */
 		ast_log(LOG_ERROR, "Unable to lock interface list???\n");
 		return AST_MODULE_LOAD_FAILURE;

Modified: team/murf/mtxprof/channels/chan_unistim.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/channels/chan_unistim.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/channels/chan_unistim.c (original)
+++ team/murf/mtxprof/channels/chan_unistim.c Thu Jun 12 01:08:54 2008
@@ -4581,10 +4581,12 @@
 static int restart_monitor(void)
 {
 	pthread_attr_t attr;
+	int lockret;
 	/* If we're supposed to be stopped -- stay stopped */
 	if (monitor_thread == AST_PTHREADT_STOP)
 		return 0;
-	if (ast_mutex_lock(&monlock)) {
+	ast_mutex_lock_assign(&monlock, lockret);
+	if (lockret) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
 		return -1;
 	}

Modified: team/murf/mtxprof/funcs/func_lock.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/funcs/func_lock.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/funcs/func_lock.c (original)
+++ team/murf/mtxprof/funcs/func_lock.c Thu Jun 12 01:08:54 2008
@@ -190,7 +190,10 @@
 		}
 	} else {
 		/* If the channel doesn't have any locks so far, then there's no possible deadlock. */
-		res = try ? ast_mutex_trylock(&current->mutex) : ast_mutex_lock(&current->mutex);
+		if (try)
+			res = ast_mutex_trylock(&current->mutex);
+		else
+			ast_mutex_lock_assign(&current->mutex,res);
 	}
 
 	if (res == 0) {

Modified: team/murf/mtxprof/include/asterisk.h
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/include/asterisk.h?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/include/asterisk.h (original)
+++ team/murf/mtxprof/include/asterisk.h Thu Jun 12 01:08:54 2008
@@ -116,20 +116,7 @@
  * not be present and CVS would expand the Revision keyword into the file's
  * revision number.
  */
-#ifdef MTX_PROFILE
-#define	HAVE_MTX_PROFILE	/* used in lock.h */
-#define ASTERISK_FILE_VERSION(file, version) \
-	static int mtx_prof = -1;       /* profile mutex */	\
-	static void __attribute__((constructor)) __register_file_version(void) \
-	{ \
-		mtx_prof = ast_add_profile("mtx_lock_" file, 0);	\
-		ast_register_file_version(file, version); \
-	} \
-	static void __attribute__((destructor)) __unregister_file_version(void) \
-	{ \
-		ast_unregister_file_version(file); \
-	}
-#else /* !MTX_PROFILE */
+
 #define ASTERISK_FILE_VERSION(file, version) \
 	static void __attribute__((constructor)) __register_file_version(void) \
 	{ \
@@ -139,7 +126,11 @@
 	{ \
 		ast_unregister_file_version(file); \
 	}
-#endif /* !MTX_PROFILE */
+
+#ifdef MTX_PROFILE
+#define	HAVE_MTX_PROFILE	/* used in lock.h */
+#endif /* MTX_PROFILE */
+
 #else /* LOW_MEMORY */
 #define ASTERISK_FILE_VERSION(file, x)
 #endif /* LOW_MEMORY */
@@ -163,10 +154,14 @@
 int ast_add_profile(const char *, uint64_t scale);
 int64_t ast_profile(int, int64_t);
 int64_t ast_mark(int, int start1_stop0);
+uint64_t ast_mark2(void);
+void ast_mark3(int mtx_ind, uint64_t start);
 #else /* LOW_MEMORY */
 #define ast_add_profile(a, b) 0
 #define ast_profile(a, b) do { } while (0)
 #define ast_mark(a, b) do { } while (0)
+#define ast_mark2() do{}while (0)
+#define ast_mark3(a, b) do { } while (0)
 #endif /* LOW_MEMORY */
 
 /*! \brief

Modified: team/murf/mtxprof/include/asterisk/linkedlists.h
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/include/asterisk/linkedlists.h?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/include/asterisk/linkedlists.h (original)
+++ team/murf/mtxprof/include/asterisk/linkedlists.h Thu Jun 12 01:08:54 2008
@@ -38,6 +38,9 @@
 */
 #define AST_LIST_LOCK(head)						\
 	ast_mutex_lock(&(head)->lock) 
+
+#define AST_LIST_LOCK_ASSIGN(head, var)				\
+	ast_mutex_lock_assign(&(head)->lock, var) 
 
 /*!
   \brief Write locks a list.

Modified: team/murf/mtxprof/include/asterisk/lock.h
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/include/asterisk/lock.h?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/include/asterisk/lock.h (original)
+++ team/murf/mtxprof/include/asterisk/lock.h Thu Jun 12 01:08:54 2008
@@ -59,18 +59,20 @@
  * non-blocking calls.
  */
 #ifndef	HAVE_MTX_PROFILE
-#define	__MTX_PROF(a)	return pthread_mutex_lock((a))
-#else
-#define	__MTX_PROF(a)	do {			\
-	int i;					\
-	/* profile only non-blocking events */	\
-	ast_mark(mtx_prof, 1);			\
-	i = pthread_mutex_trylock((a));		\
-	ast_mark(mtx_prof, 0);			\
-	if (!i)					\
-		return i;			\
-	else					\
-		return pthread_mutex_lock((a)); \
+#define	__MTX_PROF(a, file, func, lineno, start, mtx_prof)	return pthread_mutex_lock((a))
+#else
+/* make the MTX_PROF thread-safe (localize the start time, use fetchadd to add in the wait time, and bump the event count) */
+#define	__MTX_PROF(a, file, func, lineno, start, mtx_prof)	do {	\
+	int i;					    \
+	if (*(mtx_prof) == -1) {										\
+	    char nbuf[512];												\
+		snprintf(nbuf, sizeof(nbuf), "%s__%s__%d", file, func, lineno);	\
+		*(mtx_prof) = ast_add_profile(nbuf, 0);							\
+    }						                         \
+	*(start) = ast_mark2();							 \
+	i = pthread_mutex_lock((a));		             \
+    ast_mark3(*(mtx_prof), *(start));				 \
+	return i;                   \
 	} while (0)
 #endif	/* HAVE_MTX_PROFILE */
 
@@ -459,13 +461,7 @@
 		time_t seconds = time(NULL);
 		time_t wait_time, reported_wait = 0;
 		do {
-#ifdef	HAVE_MTX_PROFILE
-			ast_mark(mtx_prof, 1);
-#endif
 			res = pthread_mutex_trylock(&t->mutex);
-#ifdef	HAVE_MTX_PROFILE
-			ast_mark(mtx_prof, 0);
-#endif
 			if (res == EBUSY) {
 				wait_time = time(NULL) - seconds;
 				if (wait_time > reported_wait && (wait_time % 5) == 0) {
@@ -490,10 +486,10 @@
 	}
 #else
 #ifdef	HAVE_MTX_PROFILE
-	ast_mark(mtx_prof, 1);
-	res = pthread_mutex_trylock(&t->mutex);
-	ast_mark(mtx_prof, 0);
-	if (res)
+	/* detecting deadlocks will turn off MTX_PROFILE for the time being */
+	/* why? because mtx_prof is per-lock, and we need to pass it into
+       this func; then we need to add its local decl to whereever this
+       func is called from. Will check it out later */
 #endif
 	res = pthread_mutex_lock(&t->mutex);
 #endif /* DETECT_DEADLOCKS */
@@ -892,6 +888,7 @@
 
 #define ast_mutex_destroy(a)			__ast_pthread_mutex_destroy(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
 #define ast_mutex_lock(a)			__ast_pthread_mutex_lock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
+#define ast_mutex_lock_assign(a,retval) retval = __ast_pthread_mutex_lock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
 #define ast_mutex_unlock(a)			__ast_pthread_mutex_unlock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
 #define ast_mutex_trylock(a)			__ast_pthread_mutex_trylock(__FILE__, __LINE__, __PRETTY_FUNCTION__, #a, a)
 #define ast_cond_init(cond, attr)		__ast_cond_init(__FILE__, __LINE__, __PRETTY_FUNCTION__, #cond, cond, attr)
@@ -1441,10 +1438,12 @@
 {
 	return pthread_mutex_destroy(pmutex);
 }
-
-static inline int ast_mutex_lock(ast_mutex_t *pmutex)
-{
-	__MTX_PROF(pmutex);
+#define ast_mutex_lock(x) {int start; static int mutprof=-1; ast_mutex_lock2((x), __FILE__, __FUNCTION__,  __LINE__, &start, &mutprof);}
+#define ast_mutex_lock_assign(x,retval) {int start; static int mutprof=-1; retval = ast_mutex_lock2((x), __FILE__, __FUNCTION__,  __LINE__, &start, &mutprof);}
+	
+static inline int ast_mutex_lock2(ast_mutex_t *pmutex, char *file, const char *func, int lineno, int *start, int *mutprof)
+{
+	__MTX_PROF(pmutex, file, func, lineno, start, mutprof);
 }
 
 static inline int ast_mutex_trylock(ast_mutex_t *pmutex)

Modified: team/murf/mtxprof/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/main/asterisk.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/main/asterisk.c (original)
+++ team/murf/mtxprof/main/asterisk.c Thu Jun 12 01:08:54 2008
@@ -520,8 +520,8 @@
 	const char *name;
 	uint64_t	scale;	/* if non-zero, values are scaled by this */
 	int64_t	mark;
-	int64_t	value;
-	int64_t	events;
+	int	value;
+	int	events;
 };
 
 struct profile_data {
@@ -611,6 +611,20 @@
 		prof_data->e[i].events++;
 	}
 	return prof_data->e[i].mark;
+}
+
+uint64_t ast_mark2(void)
+{
+	return rdtsc();
+}
+
+void ast_mark3(int mtx_ind, uint64_t start)
+{
+	int time9 = rdtsc() - start;
+	if (prof_data->e[mtx_ind].scale > 1)
+		time9 /= prof_data->e[mtx_ind].scale;
+	ast_atomic_fetchadd_int(&prof_data->e[mtx_ind].value, time9);
+	ast_atomic_fetchadd_int(&prof_data->e[mtx_ind].events, 1);
 }
 
 #define DEFINE_PROFILE_MIN_MAX_VALUES min = 0; \

Modified: team/murf/mtxprof/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/main/astobj2.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/main/astobj2.c (original)
+++ team/murf/mtxprof/main/astobj2.c Thu Jun 12 01:08:54 2008
@@ -142,7 +142,8 @@
 int ao2_lock(void *user_data)
 {
 	struct astobj2 *p = INTERNAL_OBJ(user_data);
-
+	int ret;
+	
 	if (p == NULL)
 		return -1;
 
@@ -150,7 +151,8 @@
 	ast_atomic_fetchadd_int(&ao2.total_locked, 1);
 #endif
 
-	return ast_mutex_lock(&p->priv_data.lock);
+	ast_mutex_lock_assign(&p->priv_data.lock,ret);
+	return ret;
 }
 
 int ao2_unlock(void *user_data)

Modified: team/murf/mtxprof/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/main/channel.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/main/channel.c (original)
+++ team/murf/mtxprof/main/channel.c Thu Jun 12 01:08:54 2008
@@ -5028,7 +5028,7 @@
 #ifdef DEBUG_THREADS
 	res = __ast_pthread_mutex_lock(filename, lineno, func, "(channel lock)", &chan->lock_dont_use);
 #else
-	res = ast_mutex_lock(&chan->lock_dont_use);
+	ast_mutex_lock_assign(&chan->lock_dont_use, res);
 #endif
 
 	if (option_debug > 3) {

Modified: team/murf/mtxprof/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/main/pbx.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/main/pbx.c (original)
+++ team/murf/mtxprof/main/pbx.c Thu Jun 12 01:08:54 2008
@@ -4230,7 +4230,7 @@
 
 	/* if we found context, lock macrolock */
 	if (ret == 0) 
-		ret = ast_mutex_lock(&c->macrolock);
+		ast_mutex_lock_assign(&c->macrolock, ret);
 
 	return ret;
 }

Modified: team/murf/mtxprof/pbx/pbx_config.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/pbx/pbx_config.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/pbx/pbx_config.c (original)
+++ team/murf/mtxprof/pbx/pbx_config.c Thu Jun 12 01:08:54 2008
@@ -710,7 +710,8 @@
 	FILE *output;
 	struct ast_flags config_flags = { 0 };
 	const char *base, *slash, *file;
-
+	int lockret;
+	
 	switch (cmd) {
 	case CLI_INIT:
 		e->command = "dialplan save";
@@ -735,7 +736,8 @@
 	if (a->argc != 2 && a->argc != 3)
 		return CLI_SHOWUSAGE;
 
-	if (ast_mutex_lock(&save_dialplan_lock)) {
+	ast_mutex_lock_assign(&save_dialplan_lock, lockret);
+	if (lockret) {
 		ast_cli(a->fd,
 			"Failed to lock dialplan saving (another proccess saving?)\n");
 		return CLI_FAILURE;

Modified: team/murf/mtxprof/res/res_smdi.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/res/res_smdi.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/res/res_smdi.c (original)
+++ team/murf/mtxprof/res/res_smdi.c Thu Jun 12 01:08:54 2008
@@ -249,11 +249,15 @@
 
 static inline int lock_msg_q(struct ast_smdi_interface *iface, enum smdi_message_type type)
 {
+	int ret;
+	
 	switch (type) {
 	case SMDI_MWI:
-		return ast_mutex_lock(&iface->mwi_q_lock);
+		ast_mutex_lock_assign(&iface->mwi_q_lock,ret);
+		return ret;
 	case SMDI_MD:	
-		return ast_mutex_lock(&iface->md_q_lock);
+		ast_mutex_lock_assign(&iface->md_q_lock, ret);
+		return ret;
 	}
 	
 	return -1;

Modified: team/murf/mtxprof/utils/hashtest.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/utils/hashtest.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/utils/hashtest.c (original)
+++ team/murf/mtxprof/utils/hashtest.c Thu Jun 12 01:08:54 2008
@@ -48,6 +48,9 @@
 {
 	return 0;
 }
+uint64_t ast_mark2(void){ return 0;}
+void ast_mark3(int mtx_ind, uint64_t start) {}
+
 #endif
 
 struct ht_element 

Modified: team/murf/mtxprof/utils/hashtest2.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/utils/hashtest2.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/utils/hashtest2.c (original)
+++ team/murf/mtxprof/utils/hashtest2.c Thu Jun 12 01:08:54 2008
@@ -50,6 +50,9 @@
 {
 	return 0;
 }
+uint64_t ast_mark2(void){ return 0;}
+void ast_mark3(int mtx_ind, uint64_t start) {}
+
 #endif
 
 /* my OBJECT */

Modified: team/murf/mtxprof/utils/refcounter.c
URL: http://svn.digium.com/view/asterisk/team/murf/mtxprof/utils/refcounter.c?view=diff&rev=122043&r1=122042&r2=122043
==============================================================================
--- team/murf/mtxprof/utils/refcounter.c (original)
+++ team/murf/mtxprof/utils/refcounter.c Thu Jun 12 01:08:54 2008
@@ -237,6 +237,9 @@
 {
 	return 0;
 }
+uint64_t ast_mark2(void){ return 0;}
+void ast_mark3(int mtx_ind, uint64_t start) {}
+
 #endif
 
 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)




More information about the asterisk-commits mailing list