Commit 2c37ace1 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-4174 - Use kqueue for threadpool implementation on more BSD variants than just FreeBSD

or OSX - i.e NetBSD, OpenBSD, DragonFly, etc.
parent 4e9b5ff5
......@@ -267,6 +267,7 @@ SET(HAVE_SYNCH_H CACHE INTERNAL "")
SET(HAVE_SYSENT_H CACHE INTERNAL "")
SET(HAVE_SYS_CDEFS_H CACHE INTERNAL "")
SET(HAVE_SYS_DIR_H CACHE INTERNAL "")
SET(HAVE_SYS_EVENT_H CACHE INTERNAL "")
SET(HAVE_SYS_ERRLIST CACHE INTERNAL "")
SET(HAVE_SYS_FILE_H CACHE INTERNAL "")
SET(HAVE_SYS_FPU_H CACHE INTERNAL "")
......
......@@ -45,6 +45,7 @@
#cmakedefine HAVE_IA64INTRIN_H 1
#cmakedefine HAVE_IEEEFP_H 1
#cmakedefine HAVE_INTTYPES_H 1
#cmakedefine HAVE_KQUEUE 1
#cmakedefine HAVE_LIMITS_H 1
#cmakedefine HAVE_LINUX_UNISTD_H 1
#cmakedefine HAVE_LOCALE_H 1
......
......@@ -217,6 +217,7 @@ CHECK_INCLUDE_FILES (sched.h HAVE_SCHED_H)
CHECK_INCLUDE_FILES (select.h HAVE_SELECT_H)
CHECK_INCLUDE_FILES (semaphore.h HAVE_SEMAPHORE_H)
CHECK_INCLUDE_FILES ("sys/types.h;sys/dir.h" HAVE_SYS_DIR_H)
CHECK_INCLUDE_FILES ("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
CHECK_INCLUDE_FILES (sys/ndir.h HAVE_SYS_NDIR_H)
CHECK_INCLUDE_FILES (sys/pte.h HAVE_SYS_PTE_H)
CHECK_INCLUDE_FILES (stddef.h HAVE_STDDEF_H)
......@@ -466,6 +467,10 @@ CHECK_FUNCTION_EXISTS (memalign HAVE_MEMALIGN)
CHECK_FUNCTION_EXISTS (chown HAVE_CHOWN)
CHECK_FUNCTION_EXISTS (nl_langinfo HAVE_NL_LANGINFO)
IF(HAVE_SYS_EVENT_H)
CHECK_FUNCTION_EXISTS (kqueue HAVE_KQUEUE)
ENDIF()
#--------------------------------------------------------------------
# Support for WL#2373 (Use cycle counter for timing)
#--------------------------------------------------------------------
......
......@@ -29,14 +29,14 @@
#ifdef __linux__
#include <sys/epoll.h>
typedef struct epoll_event native_event;
#endif
#if defined (__FreeBSD__) || defined (__APPLE__)
#elif defined(HAVE_KQUEUE)
#include <sys/event.h>
typedef struct kevent native_event;
#endif
#if defined (__sun)
#elif defined (__sun)
#include <port.h>
typedef port_event_t native_event;
#else
#error threadpool is not available on this platform
#endif
/** Maximum number of native events a listener can read in one go */
......@@ -285,7 +285,7 @@ static void *native_event_get_userdata(native_event *event)
return event->data.ptr;
}
#elif defined (__FreeBSD__) || defined (__APPLE__)
#elif defined(HAVE_KQUEUE)
int io_poll_create()
{
return kqueue();
......@@ -386,8 +386,6 @@ static void* native_event_get_userdata(native_event *event)
{
return event->portev_user;
}
#else
#error not ported yet to this OS
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment