From b0e159fc552334bbdb075596aa115cd875aaf6bf Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Fri, 17 Nov 2006 11:40:48 +0000 Subject: [PATCH] Add a workaround for an apparent Windows bug where the delivery of asynchronous I/O completions is delayed if the thread used to start the operation is CPU bound. [SVN r36069] --- include/boost/asio/detail/win_iocp_io_service.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/boost/asio/detail/win_iocp_io_service.hpp b/include/boost/asio/detail/win_iocp_io_service.hpp index 25458775..1d971d54 100644 --- a/include/boost/asio/detail/win_iocp_io_service.hpp +++ b/include/boost/asio/detail/win_iocp_io_service.hpp @@ -260,11 +260,15 @@ private: LPOVERLAPPED overlapped = 0; ::SetLastError(0); BOOL ok = ::GetQueuedCompletionStatus(iocp_.handle, &bytes_transferred, - &completion_key, &overlapped, block ? INFINITE : 0); + &completion_key, &overlapped, block ? 1000 : 0); DWORD last_error = ::GetLastError(); if (!ok && overlapped == 0) + { + if (block && last_error == WAIT_TIMEOUT) + continue; return 0; + } if (overlapped) {