From abc84206977744f30f528f2ef27d87220266276d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 29 Jan 2025 21:24:43 +0100 Subject: [PATCH] Main: start IO threads before initializing the rest This fixes a regression triggered by commit e309941646e0ff1b6 - IORING_SETUP_SINGLE_ISSUER broke because io_uring_setup() was called fromm the main thread, yet io_uring_submit() in the I/O thread. This is because the I/O thread was not yet started when InitUringInputPlugin() was called, and BlockingCall() was invoked synchronously in the main thread. This has always been wrong, but was never noticed. --- src/Main.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Main.cxx b/src/Main.cxx index ba7827bcd..71d9a2b4a 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -329,6 +329,9 @@ MainConfigured(const CommandLineOptions &options, Instance instance; global_instance = &instance; + instance.io_thread.Start(); + instance.rtio_thread.Start(); + #ifdef ENABLE_NEIGHBOR_PLUGINS instance.neighbors = std::make_unique(); instance.neighbors->Init(raw_config, @@ -421,9 +424,6 @@ MainConfigured(const CommandLineOptions &options, }; #endif - instance.io_thread.Start(); - instance.rtio_thread.Start(); - #ifdef ENABLE_NEIGHBOR_PLUGINS if (instance.neighbors != nullptr) instance.neighbors->Open();