This commit is contained in:
Nathan Sobo
2021-04-14 12:38:16 -06:00
parent cbc1d83067
commit 36e6ed3aef
6 changed files with 329 additions and 7 deletions
+8 -4
View File
@@ -413,7 +413,7 @@ impl MutableAppContext {
windows: HashMap::new(),
ref_counts: Arc::new(Mutex::new(RefCounts::default())),
background: Arc::new(executor::Background::new()),
scoped_pool: scoped_pool::Pool::new(num_cpus::get()),
thread_pool: scoped_pool::Pool::new(num_cpus::get()),
},
actions: HashMap::new(),
global_actions: HashMap::new(),
@@ -1316,7 +1316,7 @@ pub struct AppContext {
windows: HashMap<usize, Window>,
background: Arc<executor::Background>,
ref_counts: Arc<Mutex<RefCounts>>,
scoped_pool: scoped_pool::Pool,
thread_pool: scoped_pool::Pool,
}
impl AppContext {
@@ -1356,8 +1356,8 @@ impl AppContext {
&self.background
}
pub fn scoped_pool(&self) -> &scoped_pool::Pool {
&self.scoped_pool
pub fn thread_pool(&self) -> &scoped_pool::Pool {
&self.thread_pool
}
}
@@ -1505,6 +1505,10 @@ impl<'a, T: Entity> ModelContext<'a, T> {
&self.app.ctx.background
}
pub fn thread_pool(&self) -> &scoped_pool::Pool {
&self.app.ctx.thread_pool
}
pub fn halt_stream(&mut self) {
self.halt_stream = true;
}