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
|
|
@ -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