-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
636: Add the ability to customize thread spawning r=nikomatsakis a=cuviper As an alternative to `ThreadPoolBuilder::build()` and `build_global()`, the new `spawn()` and `spawn_global()` methods take a closure which will be responsible for spawning the actual threads. This is called with a `ThreadBuilder` argument that provides the thread index, name, and stack size, with the expectation to call its `run()` method in the new thread. The motivating use cases for this are: - experimental WASM threading, to be externally implemented. - scoped threads, like the new test using `scoped_tls`. Co-authored-by: Josh Stone <cuviper@gmail.com>
- Loading branch information
Showing
8 changed files
with
533 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//! The public parts of this private module are used to create traits | ||
//! that cannot be implemented outside of our own crate. This way we | ||
//! can feel free to extend those traits without worrying about it | ||
//! being a breaking change for other implementations. | ||
|
||
/// If this type is pub but not publicly reachable, third parties | ||
/// can't name it and can't implement traits using it. | ||
#[allow(missing_debug_implementations)] | ||
pub struct PrivateMarker; | ||
|
||
macro_rules! private_decl { | ||
() => { | ||
/// This trait is private; this method exists to make it | ||
/// impossible to implement outside the crate. | ||
#[doc(hidden)] | ||
fn __rayon_private__(&self) -> ::private::PrivateMarker; | ||
} | ||
} | ||
|
||
macro_rules! private_impl { | ||
() => { | ||
fn __rayon_private__(&self) -> ::private::PrivateMarker { | ||
::private::PrivateMarker | ||
} | ||
} | ||
} |
Oops, something went wrong.