Skip to content

Clarify std::async policy behavior #5053

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
Jun 27, 2024

Conversation

Mq-b
Copy link
Contributor

@Mq-b Mq-b commented Jun 20, 2024

Update async policy description to align with C++ standard and clarify Microsoft implementation

  • Modified the description of launch::async policy to reflect that the C++ standard states the function behaves as if it invokes the callable object in a new thread.
  • Clarified that the Microsoft implementation uses the Windows ThreadPool, which may provide recycled threads, resulting in behavior equivalent to launch::async|launch::deferred.
  • Added a note about the implications for thread-local variables, recommending against their use with async.

This update ensures the documentation accurately reflects both the C++ standard and the specifics of the Microsoft implementation.

References:

Copy link
Contributor

@Mq-b : Thanks for your contribution! The author(s) have been notified to review your proposed change.

Copy link
Contributor

Learn Build status updates of commit 8e450b2:

✅ Validation status: passed

File Status Preview URL Details
docs/standard-library/future-functions.md ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

@Mq-b
Copy link
Contributor Author

Mq-b commented Jun 20, 2024

I think the main thing is that C++ doesn't specify:

The C++ standard states that if policy is launch::async, the function creates a new thread.

@Mq-b
Copy link
Contributor Author

Mq-b commented Jun 20, 2024

@frederick-vs-ja

@Court72
Copy link
Contributor

Court72 commented Jun 20, 2024

@TylerMSFT

Can you review the proposed changes?

Important: When the changes are ready for publication, adding a #sign-off comment is the best way to signal that the PR is ready for the review team to merge.

#label:"aq-pr-triaged"
@MicrosoftDocs/public-repo-pr-review-team

@prmerger-automator prmerger-automator bot added the aq-pr-triaged Tracking label for the PR review team label Jun 20, 2024
Copy link
Collaborator

@TylerMSFT TylerMSFT left a comment

Choose a reason for hiding this comment

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

Thank you

@TylerMSFT
Copy link
Collaborator

#sign-off

@ShannonLeavitt ShannonLeavitt merged commit b04472a into MicrosoftDocs:main Jun 27, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants