Skip to content

Commit 8de9126

Browse files
committed
Fix stylo compile on wasm
1 parent 1c069c5 commit 8de9126

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

style/global_style_data.rs

+16
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ pub type PlatformThreadHandle = RawPthread;
2525
#[cfg(windows)]
2626
pub type PlatformThreadHandle = RawHandle;
2727

28+
/// A noop thread join handle for wasm
29+
#[cfg(target_arch = "wasm32")]
30+
pub struct DummyThreadHandle;
31+
#[cfg(target_arch = "wasm32")]
32+
impl DummyThreadHandle {
33+
/// A noop thread join method for wasm
34+
pub fn join(&self) {
35+
// Do nothing
36+
}
37+
}
38+
#[cfg(target_arch = "wasm32")]
39+
/// Platform-specific handle to a thread.
40+
pub type PlatformThreadHandle = DummyThreadHandle;
41+
2842
/// Global style data
2943
pub struct GlobalStyleData {
3044
/// Shared RWLock for CSSOM objects
@@ -131,6 +145,8 @@ impl StyleThreadPool {
131145
let handle = join_handle.as_pthread_t();
132146
#[cfg(windows)]
133147
let handle = join_handle.as_raw_handle();
148+
#[cfg(target_arch = "wasm32")]
149+
let handle = DummyThreadHandle;
134150

135151
handles.push(handle);
136152
}

0 commit comments

Comments
 (0)