File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 26
26
//! [`join()`]: struct.ThreadPool.html#method.join
27
27
//! [`ThreadPoolBuilder`]: struct.ThreadPoolBuilder.html
28
28
//!
29
- //! ## Restricting multiple versions
29
+ //! # Global fallback when threading is unsupported
30
+ //!
31
+ //! Rayon uses `std` APIs for threading, but some targets have incomplete implementations that
32
+ //! always return `Unsupported` errors. The WebAssembly `wasm32-unknown-unknown` and `wasm32-wasi`
33
+ //! targets are notable examples of this. Rather than panicking on the unsupported error when
34
+ //! creating the implicit global threadpool, Rayon configures a fallback mode instead.
35
+ //!
36
+ //! This fallback mode mostly functions as if it were using a single-threaded "pool", like setting
37
+ //! `RAYON_NUM_THREADS=1`. For example, `join` will execute its two closures sequentially, since
38
+ //! there is no other thread to share the work. However, since the pool is not running independent
39
+ //! of the main thread, non-blocking calls like `spawn` may not execute at all, unless a lower-
40
+ //! priority call like `broadcast` gives them an opening. The fallback mode does not try to emulate
41
+ //! anything like thread preemption or `async` task switching.
42
+ //!
43
+ //! Explicit `ThreadPoolBuilder` methods always report their error without any fallback.
44
+ //!
45
+ //! # Restricting multiple versions
30
46
//!
31
47
//! In order to ensure proper coordination between threadpools, and especially
32
48
//! to make sure there's only one global threadpool, `rayon-core` is actively
Original file line number Diff line number Diff line change 76
76
//! [the `collections` from `std`]: https://doc.rust-lang.org/std/collections/index.html
77
77
//! [`std`]: https://doc.rust-lang.org/std/
78
78
//!
79
+ //! # Targets without threading
80
+ //!
81
+ //! Rayon has limited support for targets without `std` threading implementations.
82
+ //! See the [`rayon_core`] documentation for more information about its global fallback.
83
+ //!
79
84
//! # Other questions?
80
85
//!
81
86
//! See [the Rayon FAQ][faq].
You can’t perform that action at this time.
0 commit comments