]> granicus.if.org Git - curl/commitdiff
sockfilt.c: Replace 100ms sleep with thread throttle
authorMarc Hoersken <info@marc-hoersken.de>
Fri, 26 Dec 2014 09:11:47 +0000 (10:11 +0100)
committerMarc Hoersken <info@marc-hoersken.de>
Fri, 26 Dec 2014 09:15:33 +0000 (10:15 +0100)
Improves performance of test cases 574 and 575 by 50%.

A value of zero causes the thread to relinquish the remainder
of its time slice to any other thread of equal priority that is
ready to run. If there are no other threads of equal priority
ready to run, the function returns immediately, and the thread
continues execution.

http://msdn.microsoft.com/library/windows/desktop/ms686307.aspx

tests/server/sockfilt.c

index e78787670c603ad705407388fd281a183e11a601..ab4b080b4644568a16cd9b7b313cd5a3809c97b5 100644 (file)
@@ -564,7 +564,7 @@ static DWORD WINAPI select_ws_wait_thread(LPVOID lpParameter)
             /* compare position with size, abort if not equal */
             if(size.QuadPart == pos.QuadPart) {
               /* sleep and continue waiting */
-              SleepEx(100, FALSE);
+              SleepEx(0, FALSE);
               continue;
             }
           }
@@ -618,14 +618,14 @@ static DWORD WINAPI select_ws_wait_thread(LPVOID lpParameter)
         if(PeekNamedPipe(handle, NULL, 0, NULL, &length, NULL)) {
           /* if there is no data available, sleep and continue waiting */
           if(length == 0) {
-            SleepEx(100, FALSE);
+            SleepEx(0, FALSE);
             continue;
           }
         }
         else {
           /* if the pipe has been closed, sleep and continue waiting */
           if(GetLastError() == ERROR_BROKEN_PIPE) {
-            SleepEx(100, FALSE);
+            SleepEx(0, FALSE);
             continue;
           }
         }