diff options
| author | rezural <rezural@protonmail.com> | 2020-12-24 21:25:49 +1100 |
|---|---|---|
| committer | rezural <rezural@protonmail.com> | 2020-12-24 21:25:49 +1100 |
| commit | 975f0d149f84068e46c7bb8bd6514378aa6aeaf4 (patch) | |
| tree | 9321fd5ab8ccb96dd491374d7379f56252ead0a8 /src_testbed | |
| parent | 70d05cc63f24945d5d59c6e14aa6f36c36304a84 (diff) | |
| download | rapier-975f0d149f84068e46c7bb8bd6514378aa6aeaf4.tar.gz rapier-975f0d149f84068e46c7bb8bd6514378aa6aeaf4.tar.bz2 rapier-975f0d149f84068e46c7bb8bd6514378aa6aeaf4.zip | |
add num_threads back in too
Diffstat (limited to 'src_testbed')
| -rw-r--r-- | src_testbed/harness/mod.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src_testbed/harness/mod.rs b/src_testbed/harness/mod.rs index 379a42c..228ffe0 100644 --- a/src_testbed/harness/mod.rs +++ b/src_testbed/harness/mod.rs @@ -16,12 +16,18 @@ pub struct RunState { impl RunState { pub fn new() -> Self { + #[cfg(feature = "parallel")] + let num_threads = num_cpus::get_physical(); + + #[cfg(feature = "parallel")] + let thread_pool = rapier::rayon::ThreadPoolBuilder::new() + .num_threads(num_threads) + .build() + .unwrap(); + Self { #[cfg(feature = "parallel")] - thread_pool: rapier::rayon::ThreadPoolBuilder::new() - .num_threads(num_threads) - .build() - .unwrap(), + thread_pool: thread_pool, timestep_id: 0, time: 0.0, } |
