summaryrefslogtreecommitdiff
path: root/libusb
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-03-11 13:58:32 +0000
committerPete Batard <pbatard@gmail.com>2010-03-11 13:58:32 +0000
commit2b47cdb7c8b20fbab0abbaa9ef66d7725af2b94d (patch)
treec9aaf89891532c6a06924996967c7793f34af750 /libusb
parentb35a7e03dcf9ea087b267099d8d8edd4b77ee124 (diff)
downloadlibusb-2b47cdb7c8b20fbab0abbaa9ef66d7725af2b94d.tar.gz
fixed continuous polling during timeout (Graeme Gill)r204
Diffstat (limited to 'libusb')
-rw-r--r--libusb/os/threads_windows.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libusb/os/threads_windows.c b/libusb/os/threads_windows.c
index 7762190..6819059 100644
--- a/libusb/os/threads_windows.c
+++ b/libusb/os/threads_windows.c
@@ -194,11 +194,13 @@ int usbi_cond_timedwait(usbi_cond_t *cond,
TIMESPEC_TO_TIMEVAL(&targ_time, abstime);
timersub(&targ_time, &cur_time, &delta_time);
- if(delta_time.tv_sec <= 0) // abstime already passed?
+ if(delta_time.tv_sec < 0) // abstime already passed?
millis = 0;
else {
millis = delta_time.tv_usec/1000;
millis += delta_time.tv_sec *1000;
+ if (delta_time.tv_usec % 1000) // round up to next millisecond
+ millis++;
}
return usbi_cond_intwait(cond, mutex, millis);