commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r820699 - in /commons/sandbox/runtime/trunk/src/main/native/os: unix/fsysio.c win32/fsysio.c
Date Thu, 01 Oct 2009 16:04:33 GMT
Author: mturk
Date: Thu Oct  1 16:04:33 2009
New Revision: 820699

URL: http://svn.apache.org/viewvc?rev=820699&view=rev
Log:
Use common timeout calculation

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c?rev=820699&r1=820698&r2=820699&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/fsysio.c Thu Oct  1 16:04:33 2009
@@ -262,7 +262,7 @@
 
 static int wait_for_io_or_timeout(acr_file_t *f, int for_read)
 {
-    int rc, timeout = (int)(f->timeout / 1000);
+    int rc, timeout = f->timeout < 0 ? -1 : (int)(f->timeout / 1000);
     f->ppoll.fd     = f->fd;
     f->ppoll.events = for_read ? POLLIN : POLLOUT;
 
@@ -279,7 +279,7 @@
 
 static int wait_for_io(acr_file_t *f, int for_read)
 {
-    int rc, timeout = f->timeout ? (int)(f->timeout / 1000) : -1;
+    int rc, timeout = f->timeout > 0 ? (int)(f->timeout / 1000) : -1;;
     f->ppoll.fd     = f->fd;
     f->ppoll.events = for_read ? POLLIN : POLLOUT;
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c?rev=820699&r1=820698&r2=820699&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/fsysio.c Thu Oct  1 16:04:33 2009
@@ -556,12 +556,7 @@
 {
     DWORD ws;
     DWORD rc = 0;
-    DWORD tv = 0;
-
-    if (f->timeout > 0)
-        tv = (DWORD)(f->timeout / 1000);
-    else if (f->timeout == -1)
-        tv = INFINITE;
+    DWORD tv = f->timeout < 0 ? INFINITE : (DWORD)(f->timeout / 1000);
 
     do {
         switch (ws = ACR_WaitForObjectOrSignal(f->overlap.hEvent, tv)) {
@@ -615,8 +610,10 @@
 {
     DWORD ws;
     DWORD rc = 0;
-    DWORD tv = INFINITE;
+    DWORD tv =  f->timeout > 0 ? (DWORD)(f->timeout / 1000) : INFINITE;
 
+    if (f->timeout > 0)
+        tv = (DWORD)(f->timeout / 1000);
     do {
         switch (ws = ACR_WaitForObjectOrSignal(f->overlap.hEvent, tv)) {
             case WAIT_IO_COMPLETION:
@@ -1899,7 +1896,7 @@
         break;
         case ERROR_INVALID_HANDLE:
             ACR_THROW_EX_IF_ERR(ACR_EX_ACLOSED_DESC, rc);
-        break;        
+        break;
         default:
             ACR_THROW_IO_IF_ERR(f->err);
         break;



Mime
View raw message