Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement thread parking for xous #116839

Merged
merged 2 commits into from Nov 29, 2023
Merged

Conversation

joboet
Copy link
Contributor

@joboet joboet commented Oct 17, 2023

This follows the pattern set by the Windows parker when it uses keyed events. An atomic variable is used to track the state and optimize the fast path, while notifications are send via the ticktime server to block and unblock the thread.

ping @xobs
@rustbot label +T-libs +A-atomic
r? libs

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. A-atomic Area: atomics, barriers, and sync primitives labels Oct 17, 2023
Copy link
Contributor

@xobs xobs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just need to make the one change, and I think it's good to merge.

It's very similar to a local patch I'm carrying while trying to debug threading issues. I have this particular patch disabled in my local branch in order to eliminate potential issues with condvars. Thread parking improves features such as channels, so I think this is good to merge.

library/std/src/sys/xous/thread_parking.rs Outdated Show resolved Hide resolved
@joboet
Copy link
Contributor Author

joboet commented Oct 18, 2023

I forgot about the free message... There shouldn't be any waiting threads, but it's probably best to let the ticktimer server destroy the table entries.

@rustbot
Copy link
Collaborator

rustbot commented Oct 18, 2023

The Miri subtree was changed

cc @rust-lang/miri

@joboet
Copy link
Contributor Author

joboet commented Oct 18, 2023

Sorry, wrong branch 🤦

@m-ou-se
Copy link
Member

m-ou-se commented Nov 28, 2023

@bors r+

@bors
Copy link
Contributor

bors commented Nov 28, 2023

📌 Commit 2dc6ba2 has been approved by m-ou-se

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 28, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#116839 (Implement thread parking for xous)
 - rust-lang#118265 (remove the memcpy-on-equal-ptrs assumption)
 - rust-lang#118269 (Unify `TraitRefs` and `PolyTraitRefs` in `ValuePairs`)
 - rust-lang#118394 (Remove HIR opkinds)
 - rust-lang#118398 (Add proper cfgs in std)
 - rust-lang#118419 (Eagerly return `ExprKind::Err` on `yield`/`await` in wrong coroutine context)
 - rust-lang#118422 (Fix coroutine validation for mixed panic strategy)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#116839 (Implement thread parking for xous)
 - rust-lang#118265 (remove the memcpy-on-equal-ptrs assumption)
 - rust-lang#118269 (Unify `TraitRefs` and `PolyTraitRefs` in `ValuePairs`)
 - rust-lang#118394 (Remove HIR opkinds)
 - rust-lang#118398 (Add proper cfgs in std)
 - rust-lang#118419 (Eagerly return `ExprKind::Err` on `yield`/`await` in wrong coroutine context)
 - rust-lang#118422 (Fix coroutine validation for mixed panic strategy)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2eec51c into rust-lang:master Nov 29, 2023
20 of 22 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Nov 29, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 29, 2023
Rollup merge of rust-lang#116839 - joboet:xous_thread_parking, r=m-ou-se

Implement thread parking for xous

This follows the pattern set by [the Windows parker](https://github.com/rust-lang/rust/blob/ddef56d5dfa18f169af9db912dc8e8343797eebb/library/std/src/sys/windows/thread_parking.rs) when it uses keyed events. An atomic variable is used to track the state and optimize the fast path, while notifications are send via the ticktime server to block and unblock the thread.

ping `@xobs`
`@rustbot` label +T-libs +A-atomic
r? libs
@joboet joboet deleted the xous_thread_parking branch November 29, 2023 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-atomic Area: atomics, barriers, and sync primitives S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants