]> granicus.if.org Git - php/commitdiff
backport 262160e and 2d55e8c into 5.6
authorAnatol Belski <ab@php.net>
Tue, 20 Oct 2015 18:05:44 +0000 (20:05 +0200)
committerAnatol Belski <ab@php.net>
Tue, 20 Oct 2015 18:05:44 +0000 (20:05 +0200)
ext/opcache/shared_alloc_win32.c

index cf4bce005d68aba44a83ca0a93ff41e524f91d34..fd5d334269fd644f6e9e9164af1d8d1785d9e9fe 100644 (file)
@@ -205,14 +205,19 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_
                err = GetLastError();
                if (ret == ALLOC_FAIL_MAPPING) {
                        /* Mapping failed, wait for mapping object to get freed and retry */
-            CloseHandle(memfile);
+                       CloseHandle(memfile);
                        memfile = NULL;
+                       if (++map_retries >= MAX_MAP_RETRIES) {
+                               break;
+                       }
+                       zend_shared_alloc_unlock_win32();
                        Sleep(1000 * (map_retries + 1));
+                       zend_shared_alloc_lock_win32();
                } else {
                        zend_shared_alloc_unlock_win32();
                        return ret;
                }
-       } while (++map_retries < MAX_MAP_RETRIES);
+       } while (1);
 
        if (map_retries == MAX_MAP_RETRIES) {
                zend_shared_alloc_unlock_win32();