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

Removes AWS_FATAL_ASSERT in s_aws_event_loop_group_shutdown_async #515

Merged
merged 2 commits into from
Sep 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions source/event_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,14 @@ static void s_aws_event_loop_group_shutdown_async(struct aws_event_loop_group *e
struct aws_thread cleanup_thread;
AWS_ZERO_STRUCT(cleanup_thread);

AWS_FATAL_ASSERT(aws_thread_init(&cleanup_thread, el_group->allocator) == AWS_OP_SUCCESS);
aws_thread_init(&cleanup_thread, el_group->allocator);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This always return Success.


struct aws_thread_options thread_options;
AWS_ZERO_STRUCT(thread_options);
thread_options.cpu_id = -1;
thread_options.join_strategy = AWS_TJS_MANAGED;

AWS_FATAL_ASSERT(
aws_thread_launch(&cleanup_thread, s_event_loop_destroy_async_thread_fn, el_group, &thread_options) ==
AWS_OP_SUCCESS);
aws_thread_launch(&cleanup_thread, s_event_loop_destroy_async_thread_fn, el_group, &thread_options);
Copy link
Contributor Author

@waahm7 waahm7 Sep 6, 2022

Choose a reason for hiding this comment

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

This can only fail if we cannot create a thread. As the function is void, we cann’t return an AWS_OP_ERR without changing the return type. We use this function as a completion call back during aws_ref_count_init at https://github.com/awslabs/aws-c-io/blob/main/source/event_loop.c#L116 which expects the return type to be void.

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 fails and shutdown is blocking (aws_thread_join_all_managed is used without a timeout) then it will be an indefinite wait.

}

static struct aws_event_loop_group *s_event_loop_group_new(
Expand Down