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

Thread-safe implementation of AsyncCollector #6132

Conversation

verult
Copy link
Collaborator

@verult verult commented Jun 9, 2023

This will be used as the request queue, where requests are produced in both the duet and asyncio event loops, and are consumed in the asyncio event loop.

This can be upstreamed to duet.

cc @maffoo @wcourtney

@CirqBot CirqBot added the size: M 50< lines changed <250 label Jun 9, 2023
if not self._done and not self._buffer:
self._waiter = duet.AwaitableFuture()
self._lock.release()
await self._waiter
Copy link
Contributor

Choose a reason for hiding this comment

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

If this raises we will double-release when exiting the outer with self._lock block. Probably don't want to mix manual lock acquire and release calls and with statements here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for the catch! Updated.

@verult verult mentioned this pull request Jun 15, 2023
@verult
Copy link
Collaborator Author

verult commented Oct 20, 2023

The actual stream implementation has been merged (#6199). Closing

@verult verult closed this Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants