Skip to content

Commit 18ca509

Browse files
authored
Eliminate thread pool mutex (#97)
Signed-off-by: Nico Burns <[email protected]>
1 parent 16c1b68 commit 18ca509

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

style/global_style_data.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl StyleThreadPool {
101101
}
102102
{
103103
// Drop the pool.
104-
let _ = STYLE_THREAD_POOL.lock().unwrap().style_thread_pool.write().take();
104+
let _ = STYLE_THREAD_POOL.style_thread_pool.write().take();
105105
}
106106

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

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

199-
std::sync::Mutex::new(StyleThreadPool {
199+
StyleThreadPool {
200200
num_threads,
201201
style_thread_pool: RwLock::new(pool),
202-
})
202+
}
203203
};
204204

205205
/// Global style data

0 commit comments

Comments
 (0)