apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r989639 - /apr/apr/trunk/file_io/win32/pipe.c
Date Thu, 26 Aug 2010 12:21:53 GMT
Author: mturk
Date: Thu Aug 26 12:21:52 2010
New Revision: 989639

URL: http://svn.apache.org/viewvc?rev=989639&view=rev
Log:
Don't consume too much CPU while reading data

Modified:
    apr/apr/trunk/file_io/win32/pipe.c

Modified: apr/apr/trunk/file_io/win32/pipe.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/pipe.c?rev=989639&r1=989638&r2=989639&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/pipe.c (original)
+++ apr/apr/trunk/file_io/win32/pipe.c Thu Aug 26 12:21:52 2010
@@ -295,6 +295,7 @@ static apr_status_t create_socket_pipe(S
     }
     for (;;) {
         int ns;
+        int nc = 0;
         /* Listening socket is nonblocking by now.
          * The accept should create the socket
          * immediatelly because we are connected already.
@@ -322,6 +323,8 @@ static apr_status_t create_socket_pipe(S
         /* Verify the connection by reading the send identification.
          */
         do {
+            if (nc++)
+                Sleep(1);
             nrd = recv(*rd, (char *)iid, sizeof(iid), 0);
             rv = nrd == SOCKET_ERROR ? apr_get_netos_error() : APR_SUCCESS;
         } while (APR_STATUS_IS_EAGAIN(rv));



Mime
View raw message