-
Notifications
You must be signed in to change notification settings - Fork 28
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
Add Semaphore::add_permits()
#44
Add Semaphore::add_permits()
#44
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Do you mind writing tests for this?
Test added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, but I'd prefer to test the edge case.
Could you add a test where you have an Acquire
future that tries to acquire a permit on a zero-permit Semaphore
? It should return Pending
(use future::poll_once()
to test this). Then, once the add_permits(1)
function is called, it should resolve to Ready
. It should also test using another Acquire
that should not be woken up by this call.
64d7386
to
60d067a
Compare
Test added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Allows increasing the permit count of the semaphore after creation.
Fixes #22