diff --git a/hphp/runtime/vm/repo.cpp b/hphp/runtime/vm/repo.cpp index b390a822c..afadfb675 100644 --- a/hphp/runtime/vm/repo.cpp +++ b/hphp/runtime/vm/repo.cpp @@ -14,10 +14,10 @@ +----------------------------------------------------------------------+ */ +#include "runtime/vm/repo.h" #include "util/logger.h" #include "util/trace.h" #include "util/repo_schema.h" -#include "runtime/vm/repo.h" namespace HPHP { namespace VM { @@ -425,7 +425,7 @@ static int busyHandler(void* opaque, int nCalls) { Repo* repo UNUSED = static_cast(opaque); // yield to allow other threads access to the machine // spin-wait can starve other threads. - sched_yield(); + usleep(1000 * nCalls); return 1; // Tell SQLite to retry. } diff --git a/hphp/test/slow/program_functions/repo_contention.php b/hphp/test/slow/program_functions/repo_contention.php new file mode 100755 index 000000000..9b98fdd73 --- /dev/null +++ b/hphp/test/slow/program_functions/repo_contention.php @@ -0,0 +1,34 @@ + $handle) { + $status = proc_get_status($handle); + if (!$status['running']) { + proc_close($handle); + unset($handles[$i]); + } + } + } + echo "Done $num procs\n"; + return microtime(true) - $start; +} +if (count($argv) > 1) { + foobar($argv[1]); +} else { + $x10 = main(10); + $x200 = main(200); + echo $x10 * 20 < $x200 ? "Failed" : "Passed", "\n"; +} diff --git a/hphp/test/slow/program_functions/repo_contention.php.expect b/hphp/test/slow/program_functions/repo_contention.php.expect new file mode 100644 index 000000000..73f2870d0 --- /dev/null +++ b/hphp/test/slow/program_functions/repo_contention.php.expect @@ -0,0 +1,5 @@ +Starting 10 procs +Done 10 procs +Starting 200 procs +Done 200 procs +Passed diff --git a/hphp/test/verify b/hphp/test/verify index e455630ee..0ec44a6e0 100755 --- a/hphp/test/verify +++ b/hphp/test/verify @@ -32,9 +32,6 @@ $opt_server = 0; $opt_port = 8080; $opt_home = "."; $opt_threads = `cat /proc/cpuinfo | grep '^processor' | wc -l`; -if ($opt_threads > 20) { - $opt_threads = 20; -} $opt_reduce = ""; $opt_coverage = ""; $opt_hhvm = "hhvm";