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

Semaphore doc final cleanup #6050

Merged
merged 5 commits into from
Oct 5, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix token bucket acquire
  • Loading branch information
Darksonn committed Oct 5, 2023
commit 0c0c1a3ae8f8fd0bb74afad80aaac6a1c2de95cf
7 changes: 5 additions & 2 deletions tokio/src/sync/semaphore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,11 @@ use std::sync::Arc;
///
/// async fn acquire(&self) {
/// // This can return an error if the semaphore is closed, but we
/// // never close it, so just ignore errors.
/// let _ = self.sem.acquire().await;
/// // never close it, so this error can never happen.
/// let permit = self.sem.acquire().await.unwrap();
/// // To avoid releasing the permit back to the semaphore, we use
/// // the `Permit::forget` method.
Darksonn marked this conversation as resolved.
Show resolved Hide resolved
/// permit.forget();
/// }
/// }
///
Expand Down