From f8eb026610e628b8da6a0e2748c4e4083fac4d9a Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Tue, 6 Sep 2022 12:19:06 -0700 Subject: [PATCH 1/2] Removes AWS_FATAL_ASSERT --- source/event_loop.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/source/event_loop.c b/source/event_loop.c index 5eb8a084a..aa0c22fb6 100644 --- a/source/event_loop.c +++ b/source/event_loop.c @@ -54,7 +54,7 @@ static void s_event_loop_destroy_async_thread_fn(void *thread_data) { aws_thread_current_at_exit(s_event_loop_group_thread_exit, el_group); } -static void s_aws_event_loop_group_shutdown_async(struct aws_event_loop_group *el_group) { +static int s_aws_event_loop_group_shutdown_async(struct aws_event_loop_group *el_group) { /* It's possible that the last refcount was released on an event-loop thread, * so we would deadlock if we waited here for all the event-loop threads to shut down. @@ -63,16 +63,20 @@ 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); + if (aws_thread_init(&cleanup_thread, el_group->allocator)) { + return AWS_OP_ERR; + } 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); + if (aws_thread_launch(&cleanup_thread, s_event_loop_destroy_async_thread_fn, el_group, &thread_options)) { + return AWS_OP_ERR; + } + + return AWS_OP_SUCCESS; } static struct aws_event_loop_group *s_event_loop_group_new( From 6c320297482205b01f36859c80cdce415040ea88 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Tue, 6 Sep 2022 12:28:39 -0700 Subject: [PATCH 2/2] removes return int --- source/event_loop.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/source/event_loop.c b/source/event_loop.c index aa0c22fb6..4da4a762e 100644 --- a/source/event_loop.c +++ b/source/event_loop.c @@ -54,7 +54,7 @@ static void s_event_loop_destroy_async_thread_fn(void *thread_data) { aws_thread_current_at_exit(s_event_loop_group_thread_exit, el_group); } -static int s_aws_event_loop_group_shutdown_async(struct aws_event_loop_group *el_group) { +static void s_aws_event_loop_group_shutdown_async(struct aws_event_loop_group *el_group) { /* It's possible that the last refcount was released on an event-loop thread, * so we would deadlock if we waited here for all the event-loop threads to shut down. @@ -63,20 +63,14 @@ static int s_aws_event_loop_group_shutdown_async(struct aws_event_loop_group *el struct aws_thread cleanup_thread; AWS_ZERO_STRUCT(cleanup_thread); - if (aws_thread_init(&cleanup_thread, el_group->allocator)) { - return AWS_OP_ERR; - } + aws_thread_init(&cleanup_thread, el_group->allocator); struct aws_thread_options thread_options; AWS_ZERO_STRUCT(thread_options); thread_options.cpu_id = -1; thread_options.join_strategy = AWS_TJS_MANAGED; - if (aws_thread_launch(&cleanup_thread, s_event_loop_destroy_async_thread_fn, el_group, &thread_options)) { - return AWS_OP_ERR; - } - - return AWS_OP_SUCCESS; + aws_thread_launch(&cleanup_thread, s_event_loop_destroy_async_thread_fn, el_group, &thread_options); } static struct aws_event_loop_group *s_event_loop_group_new(