summaryrefslogtreecommitdiff
path: root/libusb/libusbi.h
diff options
context:
space:
mode:
Diffstat (limited to 'libusb/libusbi.h')
-rw-r--r--libusb/libusbi.h25
1 files changed, 15 insertions, 10 deletions
diff --git a/libusb/libusbi.h b/libusb/libusbi.h
index f4e9973..6e7c5ff 100644
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -220,6 +220,14 @@ static inline void usbi_dbg(const char *format, ...)
#define IS_XFERIN(xfer) (0 != ((xfer)->endpoint & LIBUSB_ENDPOINT_IN))
#define IS_XFEROUT(xfer) (!IS_XFERIN(xfer))
+/* Internal abstraction for poll (needs struct usbi_transfer on Windows) */
+#if defined(OS_LINUX) || defined(OS_DARWIN) || defined(OS_OPENBSD) || defined(OS_NETBSD)
+#include <unistd.h>
+#include "os/poll_posix.h"
+#elif defined(OS_WINDOWS) || defined(OS_WINCE)
+#include "os/poll_windows.h"
+#endif
+
/* Internal abstraction for thread synchronization */
#if defined(THREADS_POSIX)
#include "os/threads_posix.h"
@@ -257,8 +265,13 @@ struct libusb_context {
struct list_head flying_transfers;
usbi_mutex_t flying_transfers_lock;
- /* list of poll fds */
- struct list_head pollfds;
+ /* list and count of poll fds and an array of poll fd structures that is
+ * (re)allocated as necessary prior to polling, and a flag to indicate
+ * when the list of poll fds has changed since the last poll. */
+ struct list_head ipollfds;
+ POLL_NFDS_TYPE num_pollfds;
+ struct pollfd *pollfds;
+ unsigned int pollfds_modified;
usbi_mutex_t pollfds_lock;
/* a counter that is set when we want to interrupt event handling, in order
@@ -445,14 +458,6 @@ int usbi_get_config_index_by_value(struct libusb_device *dev,
void usbi_connect_device (struct libusb_device *dev);
void usbi_disconnect_device (struct libusb_device *dev);
-/* Internal abstraction for poll (needs struct usbi_transfer on Windows) */
-#if defined(OS_LINUX) || defined(OS_DARWIN) || defined(OS_OPENBSD) || defined(OS_NETBSD)
-#include <unistd.h>
-#include "os/poll_posix.h"
-#elif defined(OS_WINDOWS) || defined(OS_WINCE)
-#include "os/poll_windows.h"
-#endif
-
#if (defined(OS_WINDOWS) || defined(OS_WINCE)) && !defined(__GNUC__)
#define snprintf _snprintf
#define vsnprintf _vsnprintf