From 59e7b3e05f1b8553f2c6e9fa329543d8b42fca8e Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Fri, 11 Jan 2019 14:27:33 -0800 Subject: Use std::random_device instead of initializing via getpid getpid worked fine for this until we started trying to run Kati within a pid namespace (via nsjail). Then it consistently got the same pid, which resulted in multiple copies of Kati all running on the same CPU. Change-Id: If50846f742c3898ca92e21e0d2c78ad8e34d0128 --- affinity.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/affinity.cc b/affinity.cc index 8be3fad..92320ee 100644 --- a/affinity.cc +++ b/affinity.cc @@ -30,7 +30,7 @@ void SetAffinityForSingleThread() { cpu_set_t cs; CPU_ZERO(&cs); - std::default_random_engine generator(getpid()); + std::random_device generator; std::uniform_int_distribution distribution(0, g_flags.num_cpus - 1); int cpu = distribution(generator); -- cgit v1.2.3