From d05b9343f69a0841043963088e0003368e205bd9 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 22 Sep 2026 22:47:33 +0200 Subject: lib: restructure into vertical slices --- ttwhy/io/signal_handling.cppm | 58 ------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 ttwhy/io/signal_handling.cppm (limited to 'ttwhy/io/signal_handling.cppm') diff --git a/ttwhy/io/signal_handling.cppm b/ttwhy/io/signal_handling.cppm deleted file mode 100644 index 1f3fecc..0000000 --- a/ttwhy/io/signal_handling.cppm +++ /dev/null @@ -1,58 +0,0 @@ -module; - -#include - -#include -#include -#include - -export module ttwhy.io:signal_handling; - -namespace ttwhy::io -{ - - export template - auto handle_signals(Stream & stream, TerminalAttributes & attributes) -> asio::awaitable - { - auto executor = co_await asio::this_coro::executor; - auto signals = asio::signal_set{executor, SIGINT, SIGTERM}; - signals.add(SIGTSTP); - signals.add(SIGCONT); - - while (true) - { - auto [error, signal] = co_await signals.async_wait(asio::as_tuple(asio::use_awaitable)); - if (error) - { - co_return error; - } - - switch (signal) - { - case SIGINT: - case SIGTERM: - { - auto message = std::format("Received signal {}, exiting ...\n", signal); - co_await asio::async_write(stream, asio::buffer(message), asio::use_awaitable); - co_return asio::error_code{}; - } - case SIGTSTP: - { - attributes.canonical_mode(true).echo(true); - ::raise(SIGSTOP); - break; - } - case SIGCONT: - { - attributes.canonical_mode(false).echo(false); - break; - } - } - - if (!error) - { - } - } - } - -} // namespace ttwhy::io -- cgit v1.2.3