Skip to content

prctl instead of pthread on linux for name setup #23640

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

Merged
merged 1 commit into from
Mar 24, 2015

Conversation

nagisa
Copy link
Member

@nagisa nagisa commented Mar 23, 2015

This is more portable as far as linux is concerned.

@rust-highfive
Copy link
Contributor

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@nagisa
Copy link
Member Author

nagisa commented Mar 23, 2015

r? @alexcrichton

@rust-highfive rust-highfive assigned alexcrichton and unassigned brson Mar 23, 2015
let cname = CString::new(name).unwrap_or_else(|_| {
panic!("thread name may not contain interior null bytes")
});
assert!(prctl(PR_SET_NAME, cname.as_ptr() as libc::c_ulong, 0, 0, 0) == 0);
Copy link
Member

Choose a reason for hiding this comment

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

Won't this call return a failure on kernels which don't suppot PR_SET_NAME? I'd also be fine just ignoring the return value, if this fails it's not really the end of the world!

Copy link
Member Author

Choose a reason for hiding this comment

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

I’m ambivalent about this. Updated.

This is more portable as far as linux is concerned.
@nagisa nagisa force-pushed the thread-less-weak branch from dcef9d2 to d29d554 Compare March 23, 2015 18:08
@alexcrichton
Copy link
Member

@bors: r+ d29d554

alexcrichton added a commit to alexcrichton/rust that referenced this pull request Mar 23, 2015
This is more portable as far as linux is concerned.
@bors bors merged commit d29d554 into rust-lang:master Mar 24, 2015
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.

5 participants