From 4a784ccb7e147cb7df03d24f989f99d7a5a5c9d2 Mon Sep 17 00:00:00 2001 From: Bret Ambrose Date: Tue, 5 Nov 2024 13:48:32 -0800 Subject: [PATCH] Oops --- source/event_loop.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/event_loop.c b/source/event_loop.c index 4bc48a6b5..82b1c9b56 100644 --- a/source/event_loop.c +++ b/source/event_loop.c @@ -119,6 +119,12 @@ struct aws_event_loop_group *aws_event_loop_group_new_internal( &el_group->ref_count, el_group, (aws_simple_completion_callback *)s_aws_event_loop_group_shutdown_async); uint16_t el_count = options->loop_count; + if (el_count == 0) { + uint16_t processor_count = (uint16_t)aws_system_info_processor_count(); + /* cut them in half to avoid using hyper threads for the IO work. */ + el_count = processor_count > 1 ? processor_count / 2 : processor_count; + } + if (aws_array_list_init_dynamic(&el_group->event_loops, allocator, el_count, sizeof(struct aws_event_loop *))) { goto on_error; }