mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
code cleanup
This commit is contained in:
parent
889a8d11f5
commit
bc821a46cd
@ -165,7 +165,7 @@ fn main() {
|
||||
default_hook(panic_info);
|
||||
}));
|
||||
|
||||
//Setup tokio runtime
|
||||
// Setup tokio runtime
|
||||
use common::consts::MIN_RECOMMENDED_TOKIO_THREADS;
|
||||
use std::sync::{
|
||||
atomic::{AtomicUsize, Ordering},
|
||||
@ -173,6 +173,7 @@ fn main() {
|
||||
};
|
||||
use tokio::runtime::Builder;
|
||||
|
||||
// TODO: evaluate std::thread::available_concurrency as a num_cpus replacement
|
||||
let cores = num_cpus::get();
|
||||
let tokio_runtime = Arc::new(
|
||||
Builder::new_multi_thread()
|
||||
|
@ -247,8 +247,9 @@ impl Renderer {
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let trace_path = std::env::var_os("WGPU_TRACE_DIR").map(|v| {
|
||||
let path = std::path::PathBuf::from(v);
|
||||
let trace_env = std::env::var_os("WGPU_TRACE_DIR");
|
||||
let trace_path = trace_env.as_ref().map(|v| {
|
||||
let path = std::path::Path::new(v);
|
||||
// We don't want to continue if we can't actually collect the api trace
|
||||
assert!(
|
||||
path.exists(),
|
||||
@ -271,6 +272,7 @@ impl Renderer {
|
||||
|
||||
path
|
||||
});
|
||||
|
||||
let (device, queue) = runtime.block_on(adapter.request_device(
|
||||
&wgpu::DeviceDescriptor {
|
||||
// TODO
|
||||
|
@ -104,33 +104,28 @@ impl Singleplayer {
|
||||
let thread = builder
|
||||
.spawn(move || {
|
||||
trace!("starting singleplayer server thread");
|
||||
let mut server = None;
|
||||
if let Err(e) = result_sender.send(
|
||||
Server::new(
|
||||
settings2,
|
||||
editable_settings,
|
||||
database_settings,
|
||||
&server_data_dir,
|
||||
runtime,
|
||||
)
|
||||
.map(|s| {
|
||||
server = Some(s);
|
||||
}),
|
||||
|
||||
let (server, init_result) = match Server::new(
|
||||
settings2,
|
||||
editable_settings,
|
||||
database_settings,
|
||||
&server_data_dir,
|
||||
runtime,
|
||||
) {
|
||||
warn!(
|
||||
Ok(server) => (Some(server), Ok(())),
|
||||
Err(err) => (None, Err(err)),
|
||||
};
|
||||
|
||||
match (result_sender.send(init_result), server) {
|
||||
(Err(e), _) => warn!(
|
||||
?e,
|
||||
"Failed to send singleplayer server initialization result. Most likely \
|
||||
the channel was closed by cancelling server creation. Stopping Server"
|
||||
);
|
||||
return;
|
||||
};
|
||||
),
|
||||
(Ok(()), None) => (),
|
||||
(Ok(()), Some(server)) => run_server(server, stop_server_r, paused1),
|
||||
}
|
||||
|
||||
let server = match server {
|
||||
Some(s) => s,
|
||||
None => return,
|
||||
};
|
||||
|
||||
run_server(server, stop_server_r, paused1);
|
||||
trace!("ending singleplayer server thread");
|
||||
})
|
||||
.unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user