From 140e1145d2950cd8a88ac222848e56e4665c5db9 Mon Sep 17 00:00:00 2001 From: David Rose Date: Sun, 17 Aug 2008 06:11:36 +0000 Subject: [PATCH] ensure no static init race condition on lock-to-one-cpu --- panda/src/express/config_express.cxx | 7 ------- panda/src/express/config_express.h | 2 -- panda/src/express/trueClock.cxx | 7 +++++++ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/panda/src/express/config_express.cxx b/panda/src/express/config_express.cxx index 5f974726a1..c9b9e9bc2a 100644 --- a/panda/src/express/config_express.cxx +++ b/panda/src/express/config_express.cxx @@ -58,13 +58,6 @@ ConfigVariableBool keep_temporary_files "default) to delete these. Mainly useful for debugging " "when the process goes wrong.")); -ConfigVariableBool lock_to_one_cpu -("lock-to-one-cpu", false, - PRC_DESC("Set this to true if you want the entire process to use one " - "CPU, even on multi-core and multi-CPU workstations. This is " - "mainly a hack to solve a bug in which QueryPerformanceCounter " - "returns inconsistent results on multi-core machines. ")); - ConfigVariableInt multifile_encryption_iteration_count ("multifile-encryption-iteration-count", 0, PRC_DESC("This is a special value of encryption-iteration-count used to encrypt " diff --git a/panda/src/express/config_express.h b/panda/src/express/config_express.h index 5c36a61513..a11729fd71 100644 --- a/panda/src/express/config_express.h +++ b/panda/src/express/config_express.h @@ -61,8 +61,6 @@ extern ConfigVariableInt patchfile_zone_size; extern ConfigVariableBool keep_temporary_files; -extern ConfigVariableBool lock_to_one_cpu; - extern ConfigVariableInt multifile_encryption_iteration_count; extern ConfigVariableBool vfs_case_sensitive; diff --git a/panda/src/express/trueClock.cxx b/panda/src/express/trueClock.cxx index f7a14778de..99e60c5204 100644 --- a/panda/src/express/trueClock.cxx +++ b/panda/src/express/trueClock.cxx @@ -166,6 +166,13 @@ TrueClock() { _last_reported_time_scale = 1.0; _report_time_scale_time = 0.0; + ConfigVariableBool lock_to_one_cpu + ("lock-to-one-cpu", false, + PRC_DESC("Set this to true if you want the entire process to use one " + "CPU, even on multi-core and multi-CPU workstations. This is " + "mainly a hack to solve a bug in which QueryPerformanceCounter " + "returns inconsistent results on multi-core machines. ")); + if (lock_to_one_cpu) { set_cpu_affinity(0x01); }