diff options
author | Pete Batard <pbatard@gmail.com> | 2010-06-05 12:14:19 -0500 |
---|---|---|
committer | Daniel Drake <dan@reactivated.net> | 2010-06-05 12:16:20 -0500 |
commit | fc0af8e3f76925ad09e0fbc6d233d500753ee375 (patch) | |
tree | 1b53d16f4612f8b50985528b257c01c7a27b3275 /libusb/core.c | |
parent | 64383fb5b55a74b706967836e81cef61e57df86a (diff) | |
download | libusbx-fc0af8e3f76925ad09e0fbc6d233d500753ee375.tar.gz |
Abstract low-level event handler operations
The Windows backend uses something other than UNIX file descriptors
for event handling. Abstract out the operations to allow for this.
Diffstat (limited to 'libusb/core.c')
-rw-r--r-- | libusb/core.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libusb/core.c b/libusb/core.c index ef5d0d5..08c23fa 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -21,15 +21,14 @@ #include <config.h> #include <errno.h> -#include <poll.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> -#include <unistd.h> -#include "libusb.h" +#include "os/poll_posix.h" + #include "libusbi.h" #if defined(OS_LINUX) @@ -1043,7 +1042,7 @@ API_EXPORTED void libusb_close(libusb_device_handle *dev_handle) usbi_mutex_unlock(&ctx->pollfd_modify_lock); /* write some data on control pipe to interrupt event handlers */ - r = write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); + r = usbi_write(ctx->ctrl_pipe[1], &dummy, sizeof(dummy)); if (r <= 0) { usbi_warn(ctx, "internal signalling write failed, closing anyway"); do_close(ctx, dev_handle); @@ -1057,7 +1056,7 @@ API_EXPORTED void libusb_close(libusb_device_handle *dev_handle) libusb_lock_events(ctx); /* read the dummy data */ - r = read(ctx->ctrl_pipe[0], &dummy, sizeof(dummy)); + r = usbi_read(ctx->ctrl_pipe[0], &dummy, sizeof(dummy)); if (r <= 0) usbi_warn(ctx, "internal signalling read failed, closing anyway"); |