From e59fb733fae49a816bd17680c742997afaf60b31 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Fri, 24 Jan 2014 11:24:46 +0100 Subject: [PATCH] Compile fix for WinRT Change-Id: I836f33a231764efc341db4b35fbed46c94d92df0 Reviewed-by: Friedemann Kleint --- .../clucene/src/CLucene/config/threadCSection.h | 3 +++ .../3rdparty/clucene/src/CLucene/config/threads.cpp | 19 +++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/assistant/3rdparty/clucene/src/CLucene/config/threadCSection.h b/src/assistant/3rdparty/clucene/src/CLucene/config/threadCSection.h index ab18420..02fd255 100644 --- a/src/assistant/3rdparty/clucene/src/CLucene/config/threadCSection.h +++ b/src/assistant/3rdparty/clucene/src/CLucene/config/threadCSection.h @@ -62,6 +62,9 @@ CL_NS_DEF(util) } }; +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) + #define Sleep(x) WaitForSingleObjectEx(GetCurrentThread(), x, FALSE) +#endif #define _LUCENE_SLEEP(x) Sleep(x) #define _LUCENE_THREADMUTEX CL_NS(util)::mutex_win32 #define _LUCENE_CURRTHREADID GetCurrentThreadId() diff --git a/src/assistant/3rdparty/clucene/src/CLucene/config/threads.cpp b/src/assistant/3rdparty/clucene/src/CLucene/config/threads.cpp index 427e580..7d1222a 100644 --- a/src/assistant/3rdparty/clucene/src/CLucene/config/threads.cpp +++ b/src/assistant/3rdparty/clucene/src/CLucene/config/threads.cpp @@ -41,20 +41,31 @@ mutexGuard::~mutexGuard() //we have not explicity included windows.h and windows.h has //not been included (check _WINDOWS_), then we must define //our own definitions to the thread locking functions: +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) + extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSectionEx(CRITICAL_SECTION *, DWORD, DWORD); +#else extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(CRITICAL_SECTION *); +#endif extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(CRITICAL_SECTION *); extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(CRITICAL_SECTION *); extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(CRITICAL_SECTION *); extern "C" __declspec(dllimport) unsigned long __stdcall GetCurrentThreadId(); #endif - mutex_win32::mutex_win32(const mutex_win32& clone){ - InitializeCriticalSection(&mtx); +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) + InitializeCriticalSectionEx(&mtx, 0, 0); +#else + InitializeCriticalSection(&mtx); +#endif } mutex_win32::mutex_win32() { - InitializeCriticalSection(&mtx); - } +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) + InitializeCriticalSectionEx(&mtx, 0, 0); +#else + InitializeCriticalSection(&mtx); +#endif + } mutex_win32::~mutex_win32() { -- 2.7.4