Commit 3c0e9016 authored by Martti Mela's avatar Martti Mela
Browse files

su_wait_t defaults now to pollfd even if no HAVE_POLL

darcs-hash:20070124135153-1b897-504c921784aff4c06292782d99539892c2214ded.gz
parent 9ab6aa2f
...@@ -101,35 +101,41 @@ SOFIA_BEGIN_DECLS ...@@ -101,35 +101,41 @@ SOFIA_BEGIN_DECLS
#define SU_WAIT_MAX (64) #define SU_WAIT_MAX (64)
#else #else
#define SU_WAIT_CMP(x, y) /* If nothing works, define these as in Linux poll.h */
#define SU_WAIT_IN #define SU_WAIT_CMP(x, y) \
#define SU_WAIT_OUT (((x).fd - (y).fd) ? ((x).fd - (y).fd) : ((x).events - (y).events))
#define SU_WAIT_ERR
#define SU_WAIT_HUP #define SU_WAIT_IN 0x0001
#define SU_WAIT_ACCEPT #define SU_WAIT_OUT 0x0004
#define SU_WAIT_FOREVER #define SU_WAIT_CONNECT 0x0004
#define SU_WAIT_TIMEOUT #define SU_WAIT_ERR 0x0008
#define SU_WAIT_HUP 0x0010
#define SU_WAIT_ACCEPT 0x0001
#define SU_WAIT_FOREVER (-1)
#define SU_WAIT_TIMEOUT (-2)
#define SU_WAIT_INIT #define SU_WAIT_INIT { INVALID_SOCKET, 0, 0 }
/** Maximum number of sources supported by su_wait() */
#define SU_WAIT_MAX (0x7fffffff)
#endif #endif
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* Types */ /* Types */
#if 0 /** Wait object. */
typedef struct _pollfd { #if SU_HAVE_POLL
su_socket_t fd; /* file descriptor */
short events; /* requested events */
short revents; /* returned events */
} su_wait_t;
#elif SU_HAVE_POLL
typedef struct pollfd su_wait_t; typedef struct pollfd su_wait_t;
#elif SU_HAVE_WINSOCK #elif SU_HAVE_WINSOCK
typedef HANDLE su_wait_t; typedef HANDLE su_wait_t;
#else #else
/** Wait object. */ /* typedef struct os_specific su_wait_t; */
typedef struct os_specific su_wait_t; typedef struct _pollfd {
su_socket_t fd; /* file descriptor */
short events; /* requested events */
short revents; /* returned events */
} su_wait_t;
#endif #endif
/* Used by AD */ /* Used by AD */
......
...@@ -189,6 +189,8 @@ int su_wait_destroy(su_wait_t *waitobj) ...@@ -189,6 +189,8 @@ int su_wait_destroy(su_wait_t *waitobj)
WSACloseEvent(*waitobj); WSACloseEvent(*waitobj);
#elif SU_HAVE_POLL #elif SU_HAVE_POLL
su_wait_t w0 = { INVALID_SOCKET, 0, 0 }; su_wait_t w0 = { INVALID_SOCKET, 0, 0 };
#else
su_wait_t w0 = { INVALID_SOCKET, 0, 0 };
#endif #endif
assert(waitobj != NULL); assert(waitobj != NULL);
*waitobj = w0; *waitobj = w0;
......
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