File tree 1 file changed +20
-0
lines changed
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,21 @@ pub type PlatformThreadHandle = RawPthread;
25
25
#[ cfg( windows) ]
26
26
pub type PlatformThreadHandle = RawHandle ;
27
27
28
+ /// A noop thread join handle for wasm
29
+ /// The usize field is a dummy field to make this type non-zero sized so as not to confuse FFI
30
+ #[ cfg( target_arch = "wasm32" ) ]
31
+ pub struct DummyThreadHandle ( #[ allow( dead_code) ] usize ) ;
32
+ #[ cfg( target_arch = "wasm32" ) ]
33
+ impl DummyThreadHandle {
34
+ /// A noop thread join method for wasm
35
+ pub fn join ( & self ) {
36
+ // Do nothing
37
+ }
38
+ }
39
+ #[ cfg( target_arch = "wasm32" ) ]
40
+ /// Platform-specific handle to a thread.
41
+ pub type PlatformThreadHandle = DummyThreadHandle ;
42
+
28
43
/// Global style data
29
44
pub struct GlobalStyleData {
30
45
/// Shared RWLock for CSSOM objects
@@ -131,6 +146,11 @@ impl StyleThreadPool {
131
146
let handle = join_handle. as_pthread_t ( ) ;
132
147
#[ cfg( windows) ]
133
148
let handle = join_handle. as_raw_handle ( ) ;
149
+ #[ cfg( target_arch = "wasm32" ) ]
150
+ let handle = {
151
+ let _ = join_handle;
152
+ DummyThreadHandle ( 0 )
153
+ } ;
134
154
135
155
handles. push ( handle) ;
136
156
}
You can’t perform that action at this time.
0 commit comments