Skip to content

Conversation

@cheatfate
Copy link
Collaborator

No description provided.


if i > 0:
waiters.delete(0, i - 1)
# Workaround for callSoon() not worked correctly before
Copy link
Member

Choose a reason for hiding this comment

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

callSoon calls getThreadDispatcher, why should this be needed here?


proc release*(asem: AsyncSemaphore) =
## Release a semaphore, incrementing internal counter by one.
if asem.counter >= asem.maxcounter:
Copy link
Member

Choose a reason for hiding this comment

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

doAssert?

## If the internal counter is larger than zero on entry, decrement it by one
## and return immediately. If its zero on entry, block and wait until some
## other task has called ``release()`` to make it larger than 0.
while asem.counter <= 0:
Copy link
Member

Choose a reason for hiding this comment

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

the loop should not be needed here - there will be exactly one queue item per count below zero so they should line up perfectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants