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

Grand dispatch queue #661

Open
wants to merge 78 commits into
base: runtime_select_event_loop
Choose a base branch
from

Conversation

sbSteveK
Copy link
Contributor

@sbSteveK sbSteveK commented Jul 29, 2024

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.

@codecov-commenter
Copy link

codecov-commenter commented Jul 29, 2024

Codecov Report

Attention: Patch coverage is 63.15789% with 7 lines in your changes missing coverage. Please review.

Project coverage is 79.65%. Comparing base (c8e57c5) to head (f4414aa).

Files with missing lines Patch % Lines
source/event_loop.c 63.15% 7 Missing ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##           runtime_select_event_loop     #661      +/-   ##
=============================================================
- Coverage                      79.66%   79.65%   -0.01%     
=============================================================
  Files                             30       30              
  Lines                           6121     6123       +2     
=============================================================
+ Hits                            4876     4877       +1     
- Misses                          1245     1246       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

include/aws/io/event_loop.h Outdated Show resolved Hide resolved
include/aws/io/io.h Show resolved Hide resolved
source/darwin/dispatch_queue.h Outdated Show resolved Hide resolved
source/socket.c Outdated Show resolved Hide resolved
source/darwin/dispatch_queue_event_loop.c Outdated Show resolved Hide resolved
source/darwin/dispatch_queue_event_loop.c Show resolved Hide resolved
source/darwin/dispatch_queue_event_loop.c Outdated Show resolved Hide resolved
source/darwin/dispatch_queue_event_loop.c Outdated Show resolved Hide resolved
source/darwin/dispatch_queue_event_loop.c Outdated Show resolved Hide resolved
source/darwin/dispatch_queue_event_loop.c Outdated Show resolved Hide resolved
struct aws_string *dispatch_queue_id;

/* Synced data handle cross thread tasks and events, and event loop operations*/
struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this block separate from synced_thread_data? Does the lock in synced_thread_data guard this too? I would not split them like this

source/darwin/dispatch_queue_event_loop.c Show resolved Hide resolved
source/darwin/dispatch_queue.h Outdated Show resolved Hide resolved
source/darwin/dispatch_queue_event_loop.c Outdated Show resolved Hide resolved
source/darwin/dispatch_queue_event_loop.c Outdated Show resolved Hide resolved
source/darwin/dispatch_queue_event_loop.c Outdated Show resolved Hide resolved
}

// Iteration function that scheduled and executed by the Dispatch Queue API
static void s_run_iteration(void *context) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The locking here seems a little unnecessarily complex. If you look at a single call to s_run_iteration:

lock(context)
unlock(context)
lock(context) // via begin_iteration, also this seems wrong as you're slurping cross-thread tasks which should be protected by lock(loop) instead
unlock(context) // via begin_iteration
lock(loop)
set thread id/execution
unlock(loop)
run all tasks
lock(loop)
executing = false
unlock(loop)
lock(context) // via end_iteration, again this appears wrong since you access lock(loop) protected data here
unlock(context)

source/darwin/dispatch_queue_event_loop.c Outdated Show resolved Hide resolved
source/darwin/dispatch_queue_event_loop.c Outdated Show resolved Hide resolved
source/darwin/dispatch_queue.h Outdated Show resolved Hide resolved
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.

5 participants