Skip to content

Conversation

@CorinJG
Copy link
Contributor

@CorinJG CorinJG commented Mar 25, 2021

Motivation

The opening lines of the current documentation for tokio::sync::Mutex could be interpreted to imply std::sync::Mutex cannot be held across any .await points, which isn't the case.

Solution

Attempted to keep reasonably concise but allude to fact that not all .await points are equal in terms of bounds required.

To be more correct about fact that std Mutex can also be held across _some_ .await points
@CorinJG CorinJG marked this pull request as ready for review March 25, 2021 20:00
@Darksonn Darksonn added A-tokio Area: The main tokio crate M-sync Module: tokio/sync T-docs Topic: documentation labels Mar 25, 2021
Minor edits for improved readability. Introduced an extra paragraph under 'Which kind of mutex should you use?' explicitly warning against holding std Mutex across .await points even though it's possible in some situations.
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thanks, the new edits are much better!

Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

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

Thanks.

@Darksonn Darksonn merged commit 1a80d6e into tokio-rs:master Mar 27, 2021
@Darksonn Darksonn mentioned this pull request Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tokio Area: The main tokio crate M-sync Module: tokio/sync T-docs Topic: documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants