You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by iv...@apache.org on 2019/05/27 06:56:50 UTC
svn commit: r1860105 - /apr/apr/trunk/file_io/win32/readwrite.c
Author: ivan
Date: Mon May 27 06:56:50 2019
New Revision: 1860105
URL: http://svn.apache.org/viewvc?rev=1860105&view=rev
Log:
* file_io/win32/readwrite.c
(read_with_timeout, apr_file_write): Use apr_wait_for_single_object() helper.
Modified:
apr/apr/trunk/file_io/win32/readwrite.c
Modified: apr/apr/trunk/file_io/win32/readwrite.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/readwrite.c?rev=1860105&r1=1860104&r2=1860105&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/readwrite.c (original)
+++ apr/apr/trunk/file_io/win32/readwrite.c Mon May 27 06:56:50 2019
@@ -87,11 +87,8 @@ static apr_status_t read_with_timeout(ap
* one owner to a new proc/thread.
*/
do {
- res = WaitForSingleObject(file->pOverlapped->hEvent,
- (file->timeout > 0)
- ? (DWORD)(file->timeout/1000)
- : ((file->timeout == -1)
- ? INFINITE : 0));
+ res = apr_wait_for_single_object(file->pOverlapped->hEvent,
+ file->timeout);
} while (res == WAIT_ABANDONED);
/* There is one case that represents entirely
@@ -492,20 +489,10 @@ APR_DECLARE(apr_status_t) apr_file_write
if (rv == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) {
- DWORD timeout_ms;
DWORD res;
- if (thefile->timeout == 0) {
- timeout_ms = 0;
- }
- else if (thefile->timeout < 0) {
- timeout_ms = INFINITE;
- }
- else {
- timeout_ms = (DWORD)(thefile->timeout / 1000);
- }
-
- res = WaitForSingleObject(thefile->pOverlapped->hEvent, timeout_ms);
+ res = apr_wait_for_single_object(thefile->pOverlapped->hEvent,
+ thefile->timeout);
/* There is one case that represents entirely
* successful operations, otherwise we will cancel
@@ -533,7 +520,7 @@ APR_DECLARE(apr_status_t) apr_file_write
&& (res == WAIT_TIMEOUT))
rv = APR_TIMEUP;
- if (rv == APR_TIMEUP && timeout_ms == 0) {
+ if (rv == APR_TIMEUP && thefile->timeout == 0) {
rv = APR_EAGAIN;
}
}