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

Add a sched_getcpu wrapper #1825

Merged
merged 1 commit into from
Sep 27, 2022
Merged

Add a sched_getcpu wrapper #1825

merged 1 commit into from
Sep 27, 2022

Conversation

jonas-schievink
Copy link
Contributor

No description provided.

src/sched.rs Outdated
@@ -140,6 +140,13 @@ mod sched_linux_like {

Errno::result(res).map(drop)
}

/// Determines the CPU on which the calling thread is running.
pub fn sched_getcpu() -> Result<usize> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like this is supported on other platforms, including FreeBSD and DragonFly.

Can you move this to the sched_affinity section below (since it seems related and has these platforms already?

@rtzoeller
Copy link
Collaborator

Thanks! Can you modify the existing test here to validate that setting the affinity actually has an effect by calling sched_getcpu?

@jonas-schievink
Copy link
Contributor Author

Thanks for the review! I've addressed the comments.

@rtzoeller
Copy link
Collaborator

@jonas-schievink can you squash the current changes into a single commit? Otherwise this looks great.

@jonas-schievink
Copy link
Contributor Author

Okay, I've squashed the commits

Copy link
Collaborator

@rtzoeller rtzoeller left a comment

Choose a reason for hiding this comment

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

bors r+

@bors bors bot merged commit a40d49b into nix-rust:master Sep 27, 2022
@jonas-schievink jonas-schievink deleted the sched-getcpu branch September 27, 2022 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants