Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

appbase: rework blocking (queuing) exit signals during shutdown #6857

Merged
merged 1 commit into from
Mar 1, 2019

Conversation

spoonincode
Copy link
Contributor

Change Description

The previous fix for blocking signals during shutdown seems to have problems on older platforms/compilers/stdlibs like gcc6. To be completely frank I couldn’t quite pinpoint the exact cause but I highly suspect it is something to do with the application instance being static and thus the ordering of static destructors being unfavorable.

I’ve changed the implementation such that during startup a separate thread is run that catches the signals but after startup that thread is retired and signal handling is then handled on the main io_service. Signals end up being blocked (queued) until destruction of application’s io_service because the async_wait() will hold a shared_ptr to the signal_set. The implementation ends up being a bit long winded but means there are no shenanigans trying to clean up threads after main() has fully returned.

Consensus Changes

API Changes

Documentation Additions

The previous fix for blocking signals during shutdown seems to have problems on older platforms/compilers/stdlibs like gcc6. To be completely frank I couldn’t quite pinpoint the exact cause but I highly suspect it is something to do with the application instance being static and thus the ordering of static destructors being unfavorable.

I’ve changed the implementation such that during startup a separate thread is run that catches the signals but after startup that thread is retired and signal handling is then handled on the main io_service. Signals end up being blocked (queued) until destruction of application’s io_service because the async_wait() will hold a shared_ptr to the signal_set. The implementation ends up being a bit long winded but means there are no shenanigans trying to clean up threads after main() has fully returned.
@spoonincode spoonincode merged commit 4ebe479 into develop Mar 1, 2019
@spoonincode spoonincode deleted the appbase_sig_fix_v2 branch March 1, 2019 21:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants