From 94a38c72a7c8803d0947ac86a425152a8b1895ba Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Sat, 21 Apr 2012 12:15:45 +0200 Subject: Initialise fd_set once for signler_t object Optimisation. Up to now new fd_set was initialised in each signaler_wait call. Now the fd_set is initialised once when signaler is created. This is useful espacially on Windows where fd_set is list of pointers rather than bitset and thus can be rather large. Signed-off-by: Martin Sustrik --- src/signaler.hpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/signaler.hpp') diff --git a/src/signaler.hpp b/src/signaler.hpp index 20c2c36..a47763f 100644 --- a/src/signaler.hpp +++ b/src/signaler.hpp @@ -22,6 +22,28 @@ #define __XS_SIGNALER_HPP_INCLUDED__ #include "fd.hpp" +#include "polling.hpp" + +// On AIX, poll.h has to be included before xs.h to get consistent +// definition of pollfd structure (AIX uses 'reqevents' and 'retnevents' +// instead of 'events' and 'revents' and defines macros to map from POSIX-y +// names to AIX-specific names). +#if defined XS_USE_SYNC_POLL +#include +#elif defined XS_USE_SYNC_SELECT +#if defined XS_HAVE_WINDOWS +#include "windows.hpp" +#elif defined XS_HAVE_HPUX +#include +#include +#include +#elif defined XS_HAVE_OPENVMS +#include +#include +#else +#include +#endif +#endif namespace xs { @@ -34,6 +56,9 @@ namespace xs typedef struct { fd_t w; fd_t r; +#if defined XS_USE_SYNC_SELECT + fd_set fds; +#endif } signaler_t; // Initialise the signaler. -- cgit v1.2.3