libwinpr-synch: add detection of timerfd support
This commit is contained in:
parent
9be33f83ea
commit
190ed85a3d
@ -268,6 +268,7 @@ endif()
|
||||
|
||||
if(UNIX OR CYGWIN)
|
||||
check_include_files(sys/eventfd.h HAVE_EVENTFD_H)
|
||||
check_include_files(sys/timerfd.h HAVE_TIMERFD_H)
|
||||
set(X11_FEATURE_TYPE "RECOMMENDED")
|
||||
else()
|
||||
set(X11_FEATURE_TYPE "DISABLED")
|
||||
|
@ -30,6 +30,7 @@
|
||||
#cmakedefine HAVE_SYS_SELECT_H
|
||||
#cmakedefine HAVE_SYS_STRTIO_H
|
||||
#cmakedefine HAVE_EVENTFD_H
|
||||
#cmakedefine HAVE_TIMERFD_H
|
||||
#cmakedefine HAVE_TM_GMTOFF
|
||||
|
||||
|
||||
|
@ -20,6 +20,10 @@
|
||||
#ifndef WINPR_SYNCH_PRIVATE_H
|
||||
#define WINPR_SYNCH_PRIVATE_H
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <winpr/platform.h>
|
||||
|
||||
#include <winpr/synch.h>
|
||||
@ -70,7 +74,7 @@ struct winpr_event
|
||||
};
|
||||
typedef struct winpr_event WINPR_EVENT;
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef HAVE_TIMERFD_H
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
@ -87,7 +91,7 @@ struct winpr_timer
|
||||
PTIMERAPCROUTINE pfnCompletionRoutine;
|
||||
LPVOID lpArgToCompletionRoutine;
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef HAVE_TIMERFD_H
|
||||
struct itimerspec timeout;
|
||||
#endif
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ HANDLE CreateWaitableTimerA(LPSECURITY_ATTRIBUTES lpTimerAttributes, BOOL bManua
|
||||
timer->pfnCompletionRoutine = NULL;
|
||||
timer->lpArgToCompletionRoutine = NULL;
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef HAVE_TIMERFD_H
|
||||
timer->fd = timerfd_create(CLOCK_MONOTONIC, 0);
|
||||
|
||||
if (timer->fd <= 0)
|
||||
@ -114,7 +114,7 @@ BOOL SetWaitableTimer(HANDLE hTimer, const LARGE_INTEGER* lpDueTime, LONG lPerio
|
||||
timer->pfnCompletionRoutine = pfnCompletionRoutine;
|
||||
timer->lpArgToCompletionRoutine = lpArgToCompletionRoutine;
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef HAVE_TIMERFD_H
|
||||
ZeroMemory(&(timer->timeout), sizeof(struct itimerspec));
|
||||
|
||||
if (lpDueTime->QuadPart < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user