From 729976df279265555eb52f8e2256b47983451921 Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthm@freeswitch.org>
Date: Thu, 13 Mar 2014 12:53:43 -0500
Subject: [PATCH] FS-6211 revert 015ff5d787e6a28432d176002cc19cec1247407b and
 f6e591de4ad42a773f15359f1fc9799b6c86615c in favor of doing it in apr

---
 src/switch_apr.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/src/switch_apr.c b/src/switch_apr.c
index f310730396..57a6d017a2 100644
--- a/src/switch_apr.c
+++ b/src/switch_apr.c
@@ -595,21 +595,12 @@ struct apr_threadattr_t {
 	int priority;
 };
 #else
-/* we are implementing our own windows support for thread priority settings because apr does not*/
+/* this needs to be revisited when apr for windows supports thread priority settings */
+/* search for WIN32 in this file */
 struct apr_threadattr_t {
     apr_pool_t *pool;
     apr_int32_t detach;
     apr_size_t stacksize;
-    int priority;
-};
-struct apr_thread_t {
-    apr_pool_t *pool;
-    HANDLE td;
-    apr_int32_t cancel;
-    apr_int32_t cancel_how;
-    void *data;
-    apr_thread_start_t func;
-    apr_status_t exitval;
 };
 #endif
 
@@ -619,7 +610,9 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **
 	switch_status_t status;
 
 	if ((status = apr_threadattr_create(new_attr, pool)) == SWITCH_STATUS_SUCCESS) {
+#ifndef WIN32
 		(*new_attr)->priority = SWITCH_PRI_LOW;
+#endif
 	}
 
 	return status;
@@ -637,7 +630,9 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadatt
 
 SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_set(switch_threadattr_t *attr, switch_thread_priority_t priority)
 {
+#ifndef WIN32
 	attr->priority = priority;
+#endif
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -646,16 +641,8 @@ static char TT_KEY[] = "1";
 SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thread, switch_threadattr_t *attr,
 													 switch_thread_start_t func, void *data, switch_memory_pool_t *cont)
 {
-	apr_status_t status;
-
 	switch_core_memory_pool_set_data(cont, "_in_thread", TT_KEY);
-	status = apr_thread_create(new_thread, attr, func, data, cont);
-#ifdef WIN32
-	if (attr->priority == SWITCH_PRI_REALTIME) {
-		SetThreadPriority(((apr_thread_t*)*new_thread)->td, THREAD_PRIORITY_HIGHEST);
-	}
-#endif
-	return (switch_status_t)status;
+	return apr_thread_create(new_thread, attr, func, data, cont);
 }
 
 /* socket stubs */