Add a ThreadPool async executor to State
If we need to use simple async code in a few places, a single executor may be better than having several threads blocking on async code. This should probably use the calloop executor, but that's had issues in cosmic-workspaces, though that may not apply here.
This commit is contained in:
parent
f0bab4a40b
commit
8455869439
3 changed files with 5 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -833,6 +833,7 @@ dependencies = [
|
|||
"cosmic-text",
|
||||
"egui",
|
||||
"egui_plot",
|
||||
"futures-executor",
|
||||
"i18n-embed",
|
||||
"i18n-embed-fl",
|
||||
"iced_tiny_skia",
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ reis = { version = "0.5", features = ["calloop"] }
|
|||
clap_lex = "0.7"
|
||||
parking_lot = "0.12.5"
|
||||
logind-zbus = { version = "5.3.2", optional = true }
|
||||
futures-executor = { version = "0.3.31", features = ["thread-pool"] }
|
||||
|
||||
[dependencies.id_tree]
|
||||
branch = "feature/copy_clone"
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ use crate::{
|
|||
use anyhow::Context;
|
||||
use calloop::RegistrationToken;
|
||||
use cosmic_comp_config::output::comp::{OutputConfig, OutputState};
|
||||
use futures_executor::ThreadPool;
|
||||
use i18n_embed::{
|
||||
DesktopLanguageRequester,
|
||||
fluent::{FluentLanguageLoader, fluent_language_loader},
|
||||
|
|
@ -211,6 +212,7 @@ pub struct Common {
|
|||
pub display_handle: DisplayHandle,
|
||||
pub event_loop_handle: LoopHandle<'static, State>,
|
||||
pub event_loop_signal: LoopSignal,
|
||||
pub async_executor: ThreadPool,
|
||||
|
||||
pub popups: PopupManager,
|
||||
pub shell: Arc<parking_lot::RwLock<Shell>>,
|
||||
|
|
@ -710,6 +712,7 @@ impl State {
|
|||
display_handle: dh.clone(),
|
||||
event_loop_handle: handle,
|
||||
event_loop_signal: signal,
|
||||
async_executor: ThreadPool::builder().pool_size(1).create().unwrap(),
|
||||
|
||||
popups: PopupManager::default(),
|
||||
shell,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue