Skip to content

feat(lxc_manager): refactor to use io_uring, smart pointers, and atomics

Manfred Michaelis requested to merge lxc-manager into main

This commit refactors the LxcManager class and its dependencies to improve resource management, thread safety, and asynchronous I/O handling.

Key changes include:

  • io_uring Integration: The project now depends on liburing for efficient asynchronous I/O operations. The CMake build system is updated to find and link this library.
  • Resource Management: The ContainerSession struct now uses a std::unique_ptr with a custom deleter (lxc_container_put) for the LXC container. This ensures automatic and safe resource cleanup, preventing memory leaks.
  • Concurrency: Session ID generation is made thread-safe by using std::atomic<SessionId>. A new std::atomic<bool> flag is introduced to manage the io_uring thread's lifecycle more safely.
  • Code Simplification: The LxcManager's internal logic is streamlined by removing redundant helper functions and a manual user data pool.
  • Improved Logging: Standard output and error streams are replaced with spdlog for more robust and configurable logging.
  • Build System: The CMake file is updated to use standardized source file paths and properly link against the new liburing dependency.

Merge request reports

Loading