(prefix: &'static str)
| 15 | |
| 16 | #[cfg(feature = "logging")] |
| 17 | fn init_file_per_thread_logger(prefix: &'static str) { |
| 18 | file_per_thread_logger::initialize(prefix); |
| 19 | file_per_thread_logger::allow_uninitialized(); |
| 20 | |
| 21 | // Extending behavior of default spawner: |
| 22 | // https://docs.rs/rayon/1.1.0/rayon/struct.ThreadPoolBuilder.html#method.spawn_handler |
| 23 | // Source code says DefaultSpawner is implementation detail and |
| 24 | // shouldn't be used directly. |
| 25 | #[cfg(feature = "parallel-compilation")] |
| 26 | rayon::ThreadPoolBuilder::new() |
| 27 | .spawn_handler(move |thread| { |
| 28 | let mut b = std::thread::Builder::new(); |
| 29 | if let Some(name) = thread.name() { |
| 30 | b = b.name(name.to_owned()); |
| 31 | } |
| 32 | if let Some(stack_size) = thread.stack_size() { |
| 33 | b = b.stack_size(stack_size); |
| 34 | } |
| 35 | b.spawn(move || { |
| 36 | file_per_thread_logger::initialize(prefix); |
| 37 | thread.run() |
| 38 | })?; |
| 39 | Ok(()) |
| 40 | }) |
| 41 | .build_global() |
| 42 | .unwrap(); |
| 43 | } |
| 44 | |
| 45 | wasmtime_option_group! { |
| 46 | #[derive(PartialEq, Clone, Deserialize)] |
no test coverage detected