-
Notifications
You must be signed in to change notification settings - Fork 65
Acquire/Release Event Loop #725
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
Conversation
…up from the event loop
…ventloop_group
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #725 +/- ##
==========================================
+ Coverage 78.60% 78.74% +0.14%
==========================================
Files 30 30
Lines 6380 6385 +5
==========================================
+ Hits 5015 5028 +13
+ Misses 1365 1357 -8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Optional name change for clarity. Otherwise looks solid.
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.
Let's talk about this
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.
Similar PR: #536. I don't know why that was not merged.
This reverts commit cfd1e49.
There was concern about the original API was misleading—it suggested that it was acquiring an event loop directly, which is not accurate. In reality, the operation acquires the event loop group associated with the event loop, not the event loop itself. To avoid confusion and better reflect the actual behavior, we have updated the API name to clearly indicate that it acquires the event loop group through the event loop.
Issue #, if available:
Description of changes:
What does this PR do
This PR introduces APIs to acquire and release event loops, by acquiring and releasing the event loop group (ELG) that the event loop belongs to. If the event loop does not belong to any group, the acquire operation will fail. However, this case should never occur in practice, as users are expected to interact with the event loop group API directly.
Why do we need this
Event loops are not ref-counted. For asynchronous APIs like the Dispatch Queue, it is necessary to retain a reference to the ELG ensures the event loop isn’t destroyed while async work is still pending. Besides, In cases where we need to process tasks on an event loop outside the context of a channel (e.g., request response client), we must ensure the event loop remains alive independently of the channel or channel bootstrap.
These new APIs help to keep the event loop alive as needed.
Also merged with a previous similar PR: #536
Ideally socket should also get updated to acquire event loop (
aws-c-io/include/aws/io/socket.h
Line 159 in 7e75f17
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.