mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	More expansion of the deadlock avoidance macro, including a macro to do locking
of the channel lock git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@125020 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -289,6 +289,21 @@ int ast_find_lock_info(void *lock_addr, const char **filename, int *lineno, cons | ||||
| 		} \ | ||||
| 	} while (0) | ||||
|  | ||||
| #define DLA_UNLOCK(lock) \ | ||||
| 	do { \ | ||||
| 		const char *__filename, *__func, *__mutex_name; \ | ||||
| 		int __lineno; \ | ||||
| 		int __res = ast_find_lock_info(lock, &__filename, &__lineno, &__func, &__mutex_name); \ | ||||
| 		ast_mutex_unlock(lock); | ||||
|  | ||||
| #define DLA_LOCK(lock) \ | ||||
| 		if (__res < 0) { /* Shouldn't ever happen, but just in case... */ \ | ||||
| 			ast_mutex_lock(lock); \ | ||||
| 		} else { \ | ||||
| 			__ast_pthread_mutex_lock(__filename, __lineno, __func, __mutex_name, lock); \ | ||||
| 		} \ | ||||
| 	} while (0) | ||||
|  | ||||
| static inline void ast_reentrancy_lock(struct ast_lock_track *lt) | ||||
| { | ||||
| 	pthread_mutex_lock(<->reentr_mutex); | ||||
| @@ -1429,6 +1444,10 @@ static inline int _ast_rwlock_trywrlock(ast_rwlock_t *t, const char *name, | ||||
| 	usleep(1); \ | ||||
| 	ast_mutex_unlock(lock); | ||||
|  | ||||
| #define DLA_UNLOCK(lock)	ast_mutex_unlock(lock) | ||||
|  | ||||
| #define DLA_LOCK(lock)	ast_mutex_lock(lock) | ||||
|  | ||||
| typedef pthread_mutex_t ast_mutex_t; | ||||
|  | ||||
| #define AST_MUTEX_INIT_VALUE			((ast_mutex_t) PTHREAD_MUTEX_INIT_VALUE) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user