mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Change mutex defines so it should work on OS that don't have the _NP mutex types. Also move the #defines up so we don't need to duplicate them
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2678 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -19,6 +19,17 @@
|
||||
#define AST_PTHREADT_NULL (pthread_t) -1
|
||||
#define AST_PTHREADT_STOP (pthread_t) -2
|
||||
|
||||
/* From now on, Asterisk REQUIRES Recursive (not error checking) mutexes
|
||||
and will not run without them. */
|
||||
|
||||
#ifdef PTHREAD_MUTEX_RECURSIVE_NP
|
||||
#define AST_MUTEX_INITIALIZER PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
||||
#define AST_MUTEX_KIND PTHREAD_MUTEX_RECURSIVE_NP
|
||||
#else
|
||||
#define AST_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
|
||||
#define AST_MUTEX_KIND PTHREAD_MUTEX_RECURSIVE
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_THREADS
|
||||
|
||||
#ifdef THREAD_CRASH
|
||||
@@ -30,12 +41,6 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* From now on, Asterisk REQUIRES Recursive (not error checking) mutexes
|
||||
and will not run without them. */
|
||||
|
||||
#define AST_MUTEX_INITIALIZER PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
||||
#define AST_MUTEX_KIND PTHREAD_MUTEX_RECURSIVE_NP
|
||||
|
||||
struct ast_mutex_info {
|
||||
pthread_mutex_t mutex;
|
||||
char *file;
|
||||
@@ -155,11 +160,6 @@ static inline int __ast_pthread_mutex_destroy(char *filename, int lineno, char *
|
||||
|
||||
#else /* DEBUG_THREADS */
|
||||
|
||||
/* From now on, Asterisk REQUIRES Recursive (not error checking) mutexes
|
||||
and will not run without them. */
|
||||
#define AST_MUTEX_INITIALIZER PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
||||
#define AST_MUTEX_KIND PTHREAD_MUTEX_RECURSIVE_NP
|
||||
|
||||
typedef pthread_mutex_t ast_mutex_t;
|
||||
|
||||
#define ast_mutex_lock(t) pthread_mutex_lock(t)
|
||||
|
Reference in New Issue
Block a user