Fixed check for _GNU_SOURCE pthread extensions.

This commit is contained in:
Armin Novak 2013-08-16 11:49:35 +02:00
parent 7f89966efc
commit 1a3a6c3e0f
2 changed files with 11 additions and 2 deletions

View File

@ -18,6 +18,15 @@
set(MODULE_NAME "winpr-synch")
set(MODULE_PREFIX "WINPR_SYNCH")
INCLUDE (CheckLibraryExists)
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
check_library_exists(pthread pthread_tryjoin_np "" HAVE_PTHREAD_GNU_EXT)
list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
if(HAVE_PTHREAD_GNU_EXT)
add_definitions(-D_GNU_SOURCE -DHAVE_PTHREAD_GNU_EXT)
endif(HAVE_PTHREAD_GNU_EXT)
include_directories(../thread)
set(${MODULE_PREFIX}_SRCS

View File

@ -77,7 +77,7 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
{
if (dwMilliseconds != INFINITE)
{
#if _GNU_SOURCE
#if HAVE_PTHREAD_GNU_EXT
struct timespec timeout;
clock_gettime(CLOCK_REALTIME, &timeout);
@ -105,7 +105,7 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
mutex = (WINPR_MUTEX*) Object;
#if _GNU_SOURCE
#if HAVE_PTHREAD_GNU_EXT
if (dwMilliseconds != INFINITE)
{
struct timespec timeout;