diff options
author | Pete Batard <pbatard@gmail.com> | 2010-03-19 23:08:29 +0000 |
---|---|---|
committer | Pete Batard <pbatard@gmail.com> | 2010-03-19 23:08:29 +0000 |
commit | af66ec02a932088a84662d389115dbedf9a6e899 (patch) | |
tree | e9a70231a45e9504b451ee6a4295ae8233f8875e | |
parent | bb58fb27541972afe2666095e32b4b243ccd87b7 (diff) | |
download | libusb-af66ec02a932088a84662d389115dbedf9a6e899.tar.gz |
fixes potential race condition in poll, with pipe fdsr222
-rw-r--r-- | libusb/os/poll_windows.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libusb/os/poll_windows.c b/libusb/os/poll_windows.c index 8b2428c..b39a8dc 100644 --- a/libusb/os/poll_windows.c +++ b/libusb/os/poll_windows.c @@ -806,6 +806,7 @@ ssize_t usbi_write(int fd, const void *buf, size_t count) poll_dbg("set pipe event (thread = %08X)", GetCurrentThreadId()); SetEvent(poll_fd[index].overlapped->hEvent); + poll_fd[index].overlapped->Internal = STATUS_WAIT_0; LeaveCriticalSection(&_poll_fd[index].mutex); return sizeof(unsigned char); @@ -841,6 +842,7 @@ ssize_t usbi_read(int fd, void *buf, size_t count) poll_dbg("clr pipe event (thread = %08X)", GetCurrentThreadId()); ResetEvent(poll_fd[index].overlapped->hEvent); + poll_fd[index].overlapped->Internal = STATUS_PENDING; r = sizeof(unsigned char); |