You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ko...@apache.org on 2017/07/11 17:16:49 UTC

svn commit: r1801639 - /httpd/httpd/trunk/server/mpm/winnt/child.c

Author: kotkov
Date: Tue Jul 11 17:16:49 2017
New Revision: 1801639

URL: http://svn.apache.org/viewvc?rev=1801639&view=rev
Log:
mpm_winnt: Remove an unnecessary Sleep() in the winnt_accept() function.

This sleep occured in a situation when:

 - We don't have a free completion context in the queue
 - We can't add one, as doing so would exceed the max_num_completion_contexts
   limit (all worker threads are busy)
 - We have exceeded a 1 second timeout while waiting for it

In this case, the Sleep() call is unnecessary, as there is no intermittent
failure that can be waited out, but rather than that, it's an ordinary
situation with all workers being busy.  Presumably, calling Sleep() here
can be even considered harmful, as it affects the fairness between the
listeners that are blocked waiting for the completion context.

So, instead of calling Sleep() just check for the possible shutdown and
immediately retry acquiring a completion context.  If all worker threads
are still busy, the retry will block in the same WaitForSingleObject() call,
which is fine.

Modified:
    httpd/httpd/trunk/server/mpm/winnt/child.c

Modified: httpd/httpd/trunk/server/mpm/winnt/child.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/winnt/child.c?rev=1801639&r1=1801638&r2=1801639&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/winnt/child.c (original)
+++ httpd/httpd/trunk/server/mpm/winnt/child.c Tue Jul 11 17:16:49 2017
@@ -439,7 +439,6 @@ reinit: /* target of connect upon too ma
         if (!context) {
             rv = mpm_get_completion_context(&context);
             if (APR_STATUS_IS_TIMEUP(rv)) {
-                Sleep(100);
                 continue;
             }
             else if (rv) {