summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dickens <christopher.a.dickens@gmail.com>2014-11-17 23:53:12 -0800
committerChris Dickens <chris.dickens@hp.com>2014-12-19 11:20:11 -0800
commitf5795bfa0e5d9e2ccd1e031d02269f041101aca7 (patch)
tree3e2f0bde3ad6f18c95361b6e1b24170ff76a8fb4
parent192adf437baec398bec36de50737a570e6c2f29c (diff)
downloadlibusb-f5795bfa0e5d9e2ccd1e031d02269f041101aca7.tar.gz
core: Add new flag to record when a new poll fd is added
This flag will be useful in a subsequent commit that further consolidates event handling. Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
-rw-r--r--libusb/core.c6
-rw-r--r--libusb/libusbi.h4
-rw-r--r--libusb/version_nano.h2
3 files changed, 11 insertions, 1 deletions
diff --git a/libusb/core.c b/libusb/core.c
index 32db2a6..13100da 100644
--- a/libusb/core.c
+++ b/libusb/core.c
@@ -1215,6 +1215,12 @@ int usbi_clear_event(struct libusb_context *ctx)
*/
void usbi_fd_notification(struct libusb_context *ctx)
{
+ /* record that there is a new poll fd */
+ usbi_mutex_lock(&ctx->event_data_lock);
+ ctx->fd_notify = 1;
+ usbi_mutex_unlock(&ctx->event_data_lock);
+
+ /* signal the event pipe to interrupt event handlers */
usbi_signal_event(ctx);
}
diff --git a/libusb/libusbi.h b/libusb/libusbi.h
index ebcc0d3..cb24cf9 100644
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -294,6 +294,10 @@ struct libusb_context {
* in order to safely close a device. Protected by event_data_lock. */
unsigned int device_close;
+ /* A flag that is set when we want to interrupt event handling, in order to
+ * pick up a new fd for polling. Protected by event_data_lock. */
+ unsigned int fd_notify;
+
/* used to wait for event completion in threads other than the one that is
* event handling */
usbi_mutex_t event_waiters_lock;
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index 73d2ed1..9624091 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 10936
+#define LIBUSB_NANO 10937