summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Hjelm <hjelmn@mac.com>2009-06-19 22:18:44 +0100
committerDaniel Drake <dsd@gentoo.org>2009-06-19 22:18:44 +0100
commit86f79fbf61c2018bdf009c7ebf92b38f3a16fd0c (patch)
treea65ddfc49037412dd9392b38a38f1c1973618c3b
parentd4bd9ed4de19a9c766f7a23eea8c852cdd61c18f (diff)
downloadlibusb-86f79fbf61c2018bdf009c7ebf92b38f3a16fd0c.tar.gz
Darwin: Don't cancel transfers on timeout
...because the OS does this for us.
-rw-r--r--configure.ac1
-rw-r--r--libusb/io.c9
2 files changed, 9 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 57327c0..6a65a0d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,7 @@ case $host in
*-darwin*)
AC_DEFINE(OS_DARWIN, [], [Darwin backend])
AC_SUBST(OS_DARWIN)
+ AC_DEFINE(USBI_OS_HANDLES_TIMEOUT, [], [Backend handles timeout])
AC_MSG_RESULT([Darwin/MacOS X])
backend="darwin"
AM_LDFLAGS="-Wl,-framework -Wl,IOKit -Wl,-framework -Wl,CoreFoundation -Wl,-prebind -no-undefined"
diff --git a/libusb/io.c b/libusb/io.c
index 6c3aadb..f0e3c33 100644
--- a/libusb/io.c
+++ b/libusb/io.c
@@ -1478,10 +1478,11 @@ static void handle_timeout(struct usbi_transfer *itransfer)
static int handle_timeouts(struct libusb_context *ctx)
{
+ int r = 0;
+#ifndef USBI_OS_HANDLES_TIMEOUT
struct timespec systime_ts;
struct timeval systime;
struct usbi_transfer *transfer;
- int r = 0;
USBI_GET_CONTEXT(ctx);
pthread_mutex_lock(&ctx->flying_transfers_lock);
@@ -1520,6 +1521,8 @@ static int handle_timeouts(struct libusb_context *ctx)
out:
pthread_mutex_unlock(&ctx->flying_transfers_lock);
+#endif
+
return r;
}
@@ -1770,6 +1773,7 @@ API_EXPORTED int libusb_handle_events_locked(libusb_context *ctx,
API_EXPORTED int libusb_get_next_timeout(libusb_context *ctx,
struct timeval *tv)
{
+#ifndef USBI_OS_HANDLES_TIMEOUT
struct usbi_transfer *transfer;
struct timespec cur_ts;
struct timeval cur_tv;
@@ -1823,6 +1827,9 @@ API_EXPORTED int libusb_get_next_timeout(libusb_context *ctx,
}
return 1;
+#else
+ return 0;
+#endif
}
/** \ingroup poll