From b3ffb91539f8a1d65c397f8ac9f1809f63df1aca Mon Sep 17 00:00:00 2001
From: "Kevin P. Fleming" <kpfleming@digium.com>
Date: Fri, 11 Nov 2005 00:21:42 +0000
Subject: [PATCH] issue #5668, modified to compile on non-Cygwin platforms :-)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7061 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 ChangeLog               |  2 ++
 include/asterisk/lock.h | 16 ++++++++--------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 768cce13cd..b961d4f3af 100755
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2005-11-10  Kevin P. Fleming  <kpfleming@digium.com>
 
+	* include/asterisk/lock.h (PTHREAD_MUTEX_RECURSIVE_NP): work around header problems on Cygwin (issue #5668)
+
 	* pbx/pbx_ael.c: handle switch default cases inside macros properly (issue #5354)
 
 	* configs/voicemail.conf.sample (format): add strong warning about changing format list when mailboxes contain messages (issue #5689)
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h
index 9c2df34879..cea5d06a17 100755
--- a/include/asterisk/lock.h
+++ b/include/asterisk/lock.h
@@ -36,13 +36,9 @@
 #ifdef __APPLE__
 /* Provide the Linux initializers for MacOS X */
 #define PTHREAD_MUTEX_RECURSIVE_NP			PTHREAD_MUTEX_RECURSIVE
-#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP		 { 0x4d555458, \
-													   { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
-														 0x20 } }
-#endif
-
-#ifdef __CYGWIN__
-#define PTHREAD_MUTEX_RECURSIVE_NP					PTHREAD_MUTEX_RECURSIVE
+#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP		{ 0x4d555458, \
+							{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
+							0x20 } }
 #endif
 
 #ifdef BSD
@@ -55,7 +51,11 @@
 
 /* From now on, Asterisk REQUIRES Recursive (not error checking) mutexes
    and will not run without them. */
-#ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
+#if defined(__CYGWIN__)
+#define PTHREAD_MUTEX_RECURSIVE_NP	PTHREAD_MUTEX_RECURSIVE
+#define PTHREAD_MUTEX_INIT_VALUE 	(ast_mutex_t)18
+#define AST_MUTEX_KIND			PTHREAD_MUTEX_RECURSIVE_NP
+#elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
 #define PTHREAD_MUTEX_INIT_VALUE	PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
 #define AST_MUTEX_KIND			PTHREAD_MUTEX_RECURSIVE_NP
 #else
-- 
GitLab