-
Notifications
You must be signed in to change notification settings - Fork 61
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
Grand dispatch queue #661
base: runtime_select_event_loop
Are you sure you want to change the base?
Grand dispatch queue #661
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## runtime_select_event_loop #661 +/- ##
=============================================================
- Coverage 79.66% 79.65% -0.01%
=============================================================
Files 30 30
Lines 6122 6124 +2
=============================================================
+ Hits 4877 4878 +1
- Misses 1245 1246 +1 ☔ View full report in Codecov by Sentry. |
…io into grand_dispatch_queue
…io into grand_dispatch_queue
…io into grand_dispatch_queue
…io into grand_dispatch_queue
…io into grand_dispatch_queue
…io into grand_dispatch_queue
…io into grand_dispatch_queue
…io into grand_dispatch_queue
…io into grand_dispatch_queue
…io into grand_dispatch_queue
@@ -14,12 +14,20 @@ AWS_PUSH_SANE_WARNING_LEVEL | |||
|
|||
#define AWS_C_IO_PACKAGE_ID 1 | |||
|
|||
struct aws_io_handle; |
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.
aws_io_handle should be moved to a private header. I don't see any references outside aws-c-io
@@ -0,0 +1,66 @@ | |||
#ifndef AWS_IO_PRIVATE_DISPATCH_QUEUE_H |
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.
Is this header necessary?
Does everything in it need to be visible?
I would make the guard symbol AWS_IO_DARWIN_DISPATCH_QUEUE_H if it stays
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.
The data structures here will be required for SecItem related changes, so we shared them in the private header here.
source/socket.c
Outdated
@@ -156,6 +156,11 @@ void aws_socket_endpoint_init_local_address_for_test(struct aws_socket_endpoint | |||
struct aws_byte_buf uuid_buf = aws_byte_buf_from_empty_array(uuid_str, sizeof(uuid_str)); | |||
AWS_FATAL_ASSERT(aws_uuid_to_str(&uuid, &uuid_buf) == AWS_OP_SUCCESS); | |||
|
|||
#if defined(WS_USE_APPLE_NETWORK_FRAMEWORK) |
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.
can these be elif with a fatal assert for fall through?
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.
Also, I think this should be "AWS_USE_APPLE_NETWORK_FRAMEWORK"
entry->timestamp = timestamp; | ||
entry->loop = loop; | ||
struct dispatch_loop *dispatch_loop = loop->impl_data; | ||
aws_ref_count_acquire(&dispatch_loop->ref_count); |
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.
Concern: if scheduling service implies an inc-ref does that mean that an event loop won't terminate until all service schedules run? That would be bad.
if (dispatch_loop->synced_data.suspended) { | ||
AWS_LOGF_INFO(AWS_LS_IO_EVENT_LOOP, "id=%p: Starting event-loop thread.", (void *)event_loop); | ||
dispatch_resume(dispatch_loop->dispatch_queue); | ||
dispatch_loop->synced_data.suspended = false; |
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.
Shouldn't this schedule a service on the off-chance that there were scheduled tasks at the time of suspension?
aws_mutex_lock(&dispatch_loop->synced_data.lock); | ||
bool should_schedule = false; | ||
|
||
bool is_empty = aws_linked_list_empty(&dispatch_loop->synced_data.cross_thread_tasks); |
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.
I feel like was_empty
would be slightly better
struct aws_event_loop *event_loop = entry->loop; | ||
struct dispatch_loop *dispatch_loop = event_loop->impl_data; | ||
AWS_ASSERT(event_loop && dispatch_loop); | ||
if (entry->cancel) { |
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.
This isn't safe. You set the cancel flag under the event loop lock but you don't check it under the lock. Check should be moved inside begin_iteration
} | ||
|
||
aws_mutex_lock(&dispatch_loop->synced_data.lock); | ||
dispatch_loop->synced_data.current_thread_id = aws_thread_current_thread_id(); |
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.
Why wouldn't this be set in begin_iteration?
aws_event_loop_register_tick_end(event_loop); | ||
|
||
aws_mutex_lock(&dispatch_loop->synced_data.lock); | ||
dispatch_loop->synced_data.is_executing = false; |
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.
Why not make a part of end_iteration?
…io into grand_dispatch_queue
…io into grand_dispatch_queue
Integration of Apple's grand dispatch queue with event loop
The CI is failing for dispatch queue because of the apple network socket is not in. The socket related changes is in PR: #662
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.