 +			}
 +#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
 +			if (pthread_mutex_lock(&mutex_))
-+	                {
-+	                        perror("cURL fatal error: Error locking mutex");
-+	                        exit(-1);
-+	                }
++			{
++				perror("cURL fatal error: Error locking mutex");
++				exit(-1);
++			}
 +#endif
 +		}
 +

+			}
+#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
+			if (pthread_mutex_unlock(&mutex_))
+	                {
+	                        perror("cURL fatal error: Error unlocking mutex");
+	                        exit(-1);
+	                }
+#endif
+		}
+	};

From b052afeae0e722337421c73d183cfafda0e87a70 Mon Sep 17 00:00:00 2001
From: Haris Okanovic <haris.okanovic@ni.com>
Date: Tue, 17 May 2016 12:57:33 -0500
Subject: [PATCH] Add global init mutex

Add global_mutex.cpp/h to allow for thread-safe (un)initialization
of libcurl.

Upstream-Status: Inappropriate [NIBuild only]
---
 lib/global_mutex.cpp | 186 +++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/global_mutex.h   |  18 +++++
 2 files changed, 204 insertions(+)
 create mode 100644 lib/global_mutex.cpp
 create mode 100644 lib/global_mutex.h

diff --git a/lib/global_mutex.cpp b/lib/global_mutex.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..72f202eec68f02e9b3eb192a2b20e0d9fb7d1cf9
--- /dev/null
+++ b/lib/global_mutex.cpp
@@ -0,0 +1,186 @@
+/* Implementation of curl_global_mutex_lock() and curl_global_mutex_unlock().
+ * 
+ * @note This C++ source file MUST NOT throw exceptions, use RTTI, or
