Skip to content

Expand a bit on thread::park spurious wakeups #26856

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
Jul 21, 2015

Conversation

steveklabnik
Copy link
Member

Fixes #26475

I'm not sure this is enough, really, but I'm not totally clear on what specific information would be valuable here. In the original issue, the Java page was pretty decent, but now I can't think of a different way to word it, and copying their prose is of course not acceptable.

thoughts @alexcrichton @aturon @aidanhs ?

@rust-highfive
Copy link
Contributor

r? @aturon

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

@alexcrichton
Copy link
Member

I feel like this doesn't quite reflect the discussion in #26475, but after re-reading the module documentation I'm not actually sure what clarification is needed. @aidanhs could you weigh in with what you'd like to see?

@aidanhs
Copy link
Member

aidanhs commented Jul 21, 2015

The thing missing for me was an explanation of what this library feature brings to the table - the rest of the page talks about things impossible to achieve without library support, whereas this is effectively an optimisation of a busy-wait loop (I can't think of any other uses off-hand).

Some tweaked docs:

Every thread is equipped with some basic low-level blocking support, via the park and unpark functions. These can be used as a more CPU-efficient implementation of a spinlock.

and

The API is typically used by acquiring a handle to the current thread, placing that handle in a shared data structure so that other threads can find it, and then parking (in a loop with a check for the token actually being acquired).

@steveklabnik
Copy link
Member Author

I incorporated your suggestions, @aidanhs . Improving the module documentation makes sense too, but I'll take care of that when i run through all of std::thread together, I'm just finishing up std::io.

@alexcrichton
Copy link
Member

@bors: r+ cbdc52e

@bors
Copy link
Collaborator

bors commented Jul 21, 2015

⌛ Testing commit cbdc52e with merge 21dfd24...

bors added a commit that referenced this pull request Jul 21, 2015
Fixes #26475 

I'm not sure this is enough, really, but I'm not totally clear on what specific information would be valuable here. In the original issue, the Java page was pretty decent, but now I can't think of a different way to word it, and copying their prose is of course not acceptable.

thoughts @alexcrichton @aturon @aidanhs ?
@bors bors merged commit cbdc52e into rust-lang:master Jul 21, 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.

6 participants