Skip to content

Commit

Permalink
Fix stylo compile on wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoburns committed Sep 17, 2024
1 parent 1d95da7 commit c922a90
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions style/global_style_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ pub type PlatformThreadHandle = RawPthread;
#[cfg(windows)]
pub type PlatformThreadHandle = RawHandle;

/// A noop thread join handle for wasm
#[cfg(target_arch = "wasm32")]
pub struct DummyThreadHandle;
#[cfg(target_arch = "wasm32")]
impl DummyThreadHandle {
/// A noop thread join method for wasm
pub fn join(&self) {
// Do nothing
}
}
#[cfg(target_arch = "wasm32")]
/// Platform-specific handle to a thread.
pub type PlatformThreadHandle = DummyThreadHandle;

/// Global style data
pub struct GlobalStyleData {
/// Shared RWLock for CSSOM objects
Expand Down Expand Up @@ -131,6 +145,8 @@ impl StyleThreadPool {
let handle = join_handle.as_pthread_t();
#[cfg(windows)]
let handle = join_handle.as_raw_handle();
#[cfg(target_arch = "wasm32")]
let handle = DummyThreadHandle;

handles.push(handle);
}
Expand Down

0 comments on commit c922a90

Please sign in to comment.