mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'xacrimon/switch-threadpool-to-uvth' into 'master'
Switch threadpool implementation to uvth. See merge request veloren/veloren!328
This commit is contained in:
commit
2bf2e7f958
338
Cargo.lock
generated
338
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -10,4 +10,5 @@ common = { package = "veloren-common", path = "../common" }
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
specs = "0.14"
|
specs = "0.14"
|
||||||
vek = "0.9"
|
vek = "0.9"
|
||||||
threadpool = "1.7"
|
uvth = "3.1.0"
|
||||||
|
num_cpus = "1.10.1"
|
||||||
|
@ -22,7 +22,7 @@ use std::{
|
|||||||
sync::Arc,
|
sync::Arc,
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
};
|
};
|
||||||
use threadpool::ThreadPool;
|
use uvth::{ThreadPool, ThreadPoolBuilder};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
const SERVER_TIMEOUT: Duration = Duration::from_secs(20);
|
const SERVER_TIMEOUT: Duration = Duration::from_secs(20);
|
||||||
@ -78,11 +78,11 @@ impl Client {
|
|||||||
|
|
||||||
postbox.send_message(ClientMsg::Ping);
|
postbox.send_message(ClientMsg::Ping);
|
||||||
|
|
||||||
let mut thread_pool = threadpool::Builder::new()
|
let mut thread_pool = ThreadPoolBuilder::new()
|
||||||
.thread_name("veloren-worker".into())
|
.name("veloren-worker".into())
|
||||||
.build();
|
.build();
|
||||||
// We reduce the thread count by 1 to keep rendering smooth
|
// We reduce the thread count by 1 to keep rendering smooth
|
||||||
thread_pool.set_num_threads((thread_pool.max_count() - 1).max(1));
|
thread_pool.set_num_threads((num_cpus::get() - 1).max(1));
|
||||||
|
|
||||||
// Set client-only components
|
// Set client-only components
|
||||||
let _ = state
|
let _ = state
|
||||||
|
@ -11,7 +11,6 @@ specs = { version = "0.14", features = ["serde", "nightly"] }
|
|||||||
vek = { version = "0.9", features = ["serde"] }
|
vek = { version = "0.9", features = ["serde"] }
|
||||||
dot_vox = "4.0"
|
dot_vox = "4.0"
|
||||||
image = "0.21"
|
image = "0.21"
|
||||||
threadpool = "1.7"
|
|
||||||
mio = "0.6"
|
mio = "0.6"
|
||||||
mio-extras = "2.0"
|
mio-extras = "2.0"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
@ -11,6 +11,6 @@ world = { package = "veloren-world", path = "../world" }
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
specs = "0.14"
|
specs = "0.14"
|
||||||
vek = "0.9"
|
vek = "0.9"
|
||||||
threadpool = "1.7"
|
uvth = "3.1.0"
|
||||||
lazy_static = "1.3.0"
|
lazy_static = "1.3.0"
|
||||||
scan_fmt = "0.1.3"
|
scan_fmt = "0.1.3"
|
@ -30,7 +30,7 @@ use std::{
|
|||||||
sync::{mpsc, Arc},
|
sync::{mpsc, Arc},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
use threadpool::ThreadPool;
|
use uvth::{ThreadPool, ThreadPoolBuilder};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use world::World;
|
use world::World;
|
||||||
|
|
||||||
@ -93,8 +93,8 @@ impl Server {
|
|||||||
postoffice: PostOffice::bind(addrs.into())?,
|
postoffice: PostOffice::bind(addrs.into())?,
|
||||||
clients: Clients::empty(),
|
clients: Clients::empty(),
|
||||||
|
|
||||||
thread_pool: threadpool::Builder::new()
|
thread_pool: ThreadPoolBuilder::new()
|
||||||
.thread_name("veloren-worker".into())
|
.name("veloren-worker".into())
|
||||||
.build(),
|
.build(),
|
||||||
chunk_tx,
|
chunk_tx,
|
||||||
chunk_rx,
|
chunk_rx,
|
||||||
|
@ -153,7 +153,7 @@ impl Terrain {
|
|||||||
})
|
})
|
||||||
.min_by_key(|todo| todo.active_worker.unwrap_or(todo.started_tick))
|
.min_by_key(|todo| todo.active_worker.unwrap_or(todo.started_tick))
|
||||||
{
|
{
|
||||||
if client.thread_pool().queued_count() > 0 {
|
if client.thread_pool().queued_jobs() > 0 {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user