Skip to content

Added watching kill signal and shutdown gracefully#23

Open
Ataba29 wants to merge 1 commit into
mainfrom
dockerStopping
Open

Added watching kill signal and shutdown gracefully#23
Ataba29 wants to merge 1 commit into
mainfrom
dockerStopping

Conversation

@Ataba29

@Ataba29 Ataba29 commented Jul 22, 2026

Copy link
Copy Markdown
Owner

This PR adds graceful shutdown handling so it responds correctly to Docker's stop signal, not just manual terminal input. main.cpp now registers a SIGTERM/SIGINT handler that sets a shared atomic flag instead of relying solely on a blocking read of stdin. Reading stdin was moved to its own thread so it no longer blocks the main thread from noticing a signal-triggered shutdown. The main thread now polls the shutdown flag at short intervals, converging both the typed "stop" command and OS signals (docker stop, Ctrl+C) on the same server.stop() shutdown path. The stdin thread is detached rather than joined at shutdown, since it may still be blocked waiting for input that will never arrive when a signal rather than a keystroke triggered shutdown.

Related to #17

@Ataba29
Ataba29 requested a review from razimograbi July 22, 2026 06:08
@Ataba29 Ataba29 added the enhancement New feature or request label Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant