-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize jobserver
try_acquire
(#1037)
* Bump dep jobserver from 0.1.20 to 0.1.30 Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add `parallel::OnceLock` impl copied from `std::sync::OnceLock` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Optimize `inherited_jobserver` acquire First try `jobserver::Client::try_acquire`, which will work: - If a fifo is used as jobserver - On linux and: - preadv2 with non-blocking read available (>=5.6) - /proc is available - On Windows - On wasm if not, we will simply fallback to help thread implementation, spawning one thread to maintain compatibility with other platforms. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Use `OnceLock` in `JobTokenServer::new` Also impls `Send`, `Sync`, `RefUnwindSafe` and `UnwindSafed` when the `T` meets the criterior. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Replace vendored `OnceLock` with dep `once_cell` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix dep: `once_cell` is needed on all targets whenever feature parallel is enabled. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Refactor: `ActiveJobTokenServer::new` no longer returns `Result` There is no need to, it never fails. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Add back TODO --------- Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
- Loading branch information
Showing
3 changed files
with
62 additions
and
46 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