Fixed check for _GNU_SOURCE pthread extensions.
This commit is contained in:
parent
7f89966efc
commit
1a3a6c3e0f
@ -18,6 +18,15 @@
|
|||||||
set(MODULE_NAME "winpr-synch")
|
set(MODULE_NAME "winpr-synch")
|
||||||
set(MODULE_PREFIX "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)
|
include_directories(../thread)
|
||||||
|
|
||||||
set(${MODULE_PREFIX}_SRCS
|
set(${MODULE_PREFIX}_SRCS
|
||||||
|
@ -77,7 +77,7 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
|
|||||||
{
|
{
|
||||||
if (dwMilliseconds != INFINITE)
|
if (dwMilliseconds != INFINITE)
|
||||||
{
|
{
|
||||||
#if _GNU_SOURCE
|
#if HAVE_PTHREAD_GNU_EXT
|
||||||
struct timespec timeout;
|
struct timespec timeout;
|
||||||
|
|
||||||
clock_gettime(CLOCK_REALTIME, &timeout);
|
clock_gettime(CLOCK_REALTIME, &timeout);
|
||||||
@ -105,7 +105,7 @@ DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
|
|||||||
|
|
||||||
mutex = (WINPR_MUTEX*) Object;
|
mutex = (WINPR_MUTEX*) Object;
|
||||||
|
|
||||||
#if _GNU_SOURCE
|
#if HAVE_PTHREAD_GNU_EXT
|
||||||
if (dwMilliseconds != INFINITE)
|
if (dwMilliseconds != INFINITE)
|
||||||
{
|
{
|
||||||
struct timespec timeout;
|
struct timespec timeout;
|
||||||
|
Loading…
Reference in New Issue
Block a user