Skip to content

Commit

Permalink
Eliminate thread pool mutex (#97)
Browse files Browse the repository at this point in the history
Signed-off-by: Nico Burns <[email protected]>
  • Loading branch information
nicoburns authored Dec 5, 2024
1 parent 16c1b68 commit 18ca509
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions style/global_style_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl StyleThreadPool {
}
{
// Drop the pool.
let _ = STYLE_THREAD_POOL.lock().unwrap().style_thread_pool.write().take();
let _ = STYLE_THREAD_POOL.style_thread_pool.write().take();
}

// Join spawned threads until all of the threads have been joined. This
Expand Down Expand Up @@ -153,7 +153,7 @@ pub(crate) const STYLO_MAX_THREADS: usize = 6;

lazy_static! {
/// Global thread pool
pub static ref STYLE_THREAD_POOL: std::sync::Mutex<StyleThreadPool> = {
pub static ref STYLE_THREAD_POOL: StyleThreadPool = {
use std::cmp;
// We always set this pref on startup, before layout or script have had a chance of
// accessing (and thus creating) the thread-pool.
Expand Down Expand Up @@ -196,10 +196,10 @@ lazy_static! {
(workers.ok(), Some(num_threads))
};

std::sync::Mutex::new(StyleThreadPool {
StyleThreadPool {
num_threads,
style_thread_pool: RwLock::new(pool),
})
}
};

/// Global style data
Expand Down

0 comments on commit 18ca509

Please sign in to comment.