Skip to content

Commit

Permalink
Disable runtime Windows version test unless targeting older Windows v…
Browse files Browse the repository at this point in the history
…ersions.
  • Loading branch information
chriskohlhoff committed Apr 3, 2023
1 parent fb451d4 commit 352177e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions asio/include/asio/detail/impl/win_iocp_io_context.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ size_t win_iocp_io_context::do_one(DWORD msec,

DWORD win_iocp_io_context::get_gqcs_timeout()
{
#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0600)
OSVERSIONINFOEX osvi;
ZeroMemory(&osvi, sizeof(osvi));
osvi.dwOSVersionInfoSize = sizeof(osvi);
Expand All @@ -542,6 +543,9 @@ DWORD win_iocp_io_context::get_gqcs_timeout()
return INFINITE;

return default_gqcs_timeout;
#else // !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0600)
return INFINITE;
#endif // !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0600)
}

void win_iocp_io_context::do_add_timer_queue(timer_queue_base& queue)
Expand Down
2 changes: 2 additions & 0 deletions asio/include/asio/detail/win_iocp_io_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,13 @@ class win_iocp_io_context

enum
{
#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0600)
// Timeout to use with GetQueuedCompletionStatus on older versions of
// Windows. Some versions of windows have a "bug" where a call to
// GetQueuedCompletionStatus can appear stuck even though there are events
// waiting on the queue. Using a timeout helps to work around the issue.
default_gqcs_timeout = 500,
#endif // !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0600)

// Maximum waitable timer timeout, in milliseconds.
max_timeout_msec = 5 * 60 * 1000,
Expand Down

0 comments on commit 352177e

Please sign in to comment.