From e0f5c89bb8018f4b4ec71023d5c31333e4f2c98f Mon Sep 17 00:00:00 2001
From: atraczyk <andreastraczyk@gmail.com>
Date: Wed, 14 Dec 2016 18:18:43 -0500
Subject: [PATCH] build: use thread_local instead of __thread for UWP build

- Causes the UWP build condition to use thread_local when
  registering threads with pj_thread_register(), as __thread is
  not available. Note: __declspec(thread) is also equivalent.

Change-Id: Ibee418d4c7084264acb0591015cdb8f72abc50ba
Tuleap: #790
---
 src/ice_transport.cpp   | 2 +-
 src/sip/sipaccount.cpp  | 2 +-
 src/sip/sipvoiplink.cpp | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/ice_transport.cpp b/src/ice_transport.cpp
index 9db5816406..361bb47e95 100644
--- a/src/ice_transport.cpp
+++ b/src/ice_transport.cpp
@@ -56,7 +56,7 @@ register_thread()
 {
     // We have to register the external thread so it could access the pjsip frameworks
     if (!pj_thread_is_registered()) {
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || defined RING_UWP
         static thread_local pj_thread_desc desc;
         static thread_local pj_thread_t *this_thread;
 #else
diff --git a/src/sip/sipaccount.cpp b/src/sip/sipaccount.cpp
index acbce0822c..37f37b1287 100644
--- a/src/sip/sipaccount.cpp
+++ b/src/sip/sipaccount.cpp
@@ -716,7 +716,7 @@ void SIPAccount::doRegister()
         std::thread{ [shared] {
             /* We have to register the external thread so it could access the pjsip frameworks */
             if (!pj_thread_is_registered()) {
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || defined RING_UWP
                     static thread_local pj_thread_desc desc;
                     static thread_local pj_thread_t *this_thread;
 #else
diff --git a/src/sip/sipvoiplink.cpp b/src/sip/sipvoiplink.cpp
index 213f28bcba..e69e7e1e14 100644
--- a/src/sip/sipvoiplink.cpp
+++ b/src/sip/sipvoiplink.cpp
@@ -674,7 +674,7 @@ SIPVoIPLink::handleEvents()
 {
     // We have to register the external thread so it could access the pjsip frameworks
     if (!pj_thread_is_registered()) {
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || defined RING_UWP
         static thread_local pj_thread_desc desc;
         static thread_local pj_thread_t *this_thread;
 #else
-- 
GitLab