refactor(semaphore): remove acquire-and-forget helpers - #175
Merged
Conversation
These helpers only compose permit acquisition with permit-level forget and add no independent semantics. Keep that operation explicit at the call site instead. Signed-off-by: tison <wander4096@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remove these redundant convenience methods for 0.7:
Semaphore::try_acquire_and_forgetSemaphore::acquire_and_forgetSemaphore::try_acquire_owned_and_forgetSemaphore::acquire_owned_and_forgetPermit-level
SemaphorePermit::forgetandOwnedSemaphorePermit::forgetremain unchanged. The changelog documents the migration.Rationale
These helpers were introduced in #33 together with the public
Semaphore::release_allAPI for an uncoupled acquire/release workflow. #34 removedrelease_allbecause it was a footgun, leaving four helpers that only compose existing operations.The same behavior remains explicit through permit guards:
This operation still uses the normal fair acquisition queue and remains cancellable while waiting. It is intentionally distinct from the immediate bounded
drain_permitsand exactreduce_permitsoperations clarified in #174. Expressing it as acquisition followed by permit-levelforgetpreserves that distinction without four extra public methods.Testing
cargo x lintcargo x checkcargo x test --no-capturecargo test --workspace --all-features