Skip to content

Commit

Permalink
sync: add OwnedSemaphorePermit::semaphore (#5618)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvra authored Apr 15, 2023
1 parent fc1e03f commit 3b16564
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tokio/src/sync/semaphore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,11 @@ impl OwnedSemaphorePermit {
self.permits += other.permits;
other.permits = 0;
}

/// Returns the [`Semaphore`] from which this permit was acquired.
pub fn semaphore(&self) -> &Arc<Semaphore> {
&self.sem
}
}

impl Drop for SemaphorePermit<'_> {
Expand Down

0 comments on commit 3b16564

Please sign in to comment.