]> granicus.if.org Git - php/commitdiff
gettimeofday cannot be used to reliably implement high precision process synchronization
authorJoe Watkins <krakjoe@php.net>
Sun, 16 Jun 2019 05:02:28 +0000 (07:02 +0200)
committerJoe Watkins <krakjoe@php.net>
Sun, 16 Jun 2019 05:02:28 +0000 (07:02 +0200)
The use of gettimeofday in time_sleep_until is technically incorrect, it's not possible
to use gettimeofday in this way reliably on any platform: It relies on operating system
global structures, which may be modified by any other process on the system at any time.

While in practice, users may be ignoring this flaw, it entirely depends on the other software
running on the system to which the application is deployed, there is no possible way to write
a test that will always pass on any system, therefore it must be marked XFAIL.

ext/standard/tests/misc/time_sleep_until_basic.phpt

index cac7133e955a130f324095b27f9966b4c3cf15ab..7f35677d1ed59a6bffde6df6b618a29c56e03e31 100644 (file)
@@ -32,3 +32,5 @@ Michele Orselli mo@ideato.it
 --EXPECT--
 bool(true)
 bool(true)
+--XFAIL--
+gettimeofday cannot be used to reliably implement high precision process synchronization