From 17241c8bcd1e26cd006a56378a0119275612b5c3 Mon Sep 17 00:00:00 2001
From: Michael Giagnocavo <mgg@giagnocavo.net>
Date: Sun, 26 Jul 2015 19:56:32 -0600
Subject: [PATCH 1/2] FS-7894: Event header ARRAY:: data -- use strcmp to
 ensure data begins with ARRAY:: instead of substring search

---
 src/switch_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/switch_event.c b/src/switch_event.c
index 7eb574f960..ae73436306 100644
--- a/src/switch_event.c
+++ b/src/switch_event.c
@@ -1053,7 +1053,7 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc
 			switch_event_del_header(event, header_name);
 		}
 
-		if (strstr(data, "ARRAY::")) {
+		if (!strncmp(data, "ARRAY::", 7)) {
 			switch_event_add_array(event, header_name, data);
 			FREE(data);
 			goto end;

From c599f4f44701af865283f33eb0100d395fa77c7f Mon Sep 17 00:00:00 2001
From: Michael Giagnocavo <mgg@giagnocavo.net>
Date: Sun, 26 Jul 2015 20:02:22 -0600
Subject: [PATCH 2/2] FS-7894: On Windows, use critical sections instead of
 mutexes. (Mutexes on Windows are cross-process, unlike lightweight Linux
 futexes.)

---
 src/switch_apr.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/switch_apr.c b/src/switch_apr.c
index f1f64df360..81b448eba5 100644
--- a/src/switch_apr.c
+++ b/src/switch_apr.c
@@ -269,6 +269,11 @@ SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock
 
 SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t ** lock, unsigned int flags, switch_memory_pool_t *pool)
 {
+#ifdef WIN32
+	/* Old version of APR misunderstands mutexes. On Windows, mutexes are cross-process. 
+	   APR has no reason to not use critical sections instead of mutexes. */
+	if (flags == SWITCH_MUTEX_NESTED) flags = SWITCH_MUTEX_DEFAULT;
+#endif
 	return apr_thread_mutex_create(lock, flags, pool);
 }