Fix hypothetical threading issues with signal handlers in main.cpp