Don't use `sig_atomic_t` on Windows.

We don't setup signal handler on Windows, so we can replace
`volatil sig_atomic_t` by simple `bool`.
pull/695/head
Matthieu Gautier 2 years ago
parent 945c4d61e6
commit cebe079c11

@ -111,10 +111,9 @@ inline std::string normalizeRootUrl(std::string rootUrl)
return rootUrl.empty() ? rootUrl : "/" + rootUrl; return rootUrl.empty() ? rootUrl : "/" + rootUrl;
} }
#ifndef _WIN32
volatile sig_atomic_t waiting = false; volatile sig_atomic_t waiting = false;
volatile sig_atomic_t libraryMustBeReloaded = false; volatile sig_atomic_t libraryMustBeReloaded = false;
#ifndef _WIN32
void handle_sigterm(int signum) void handle_sigterm(int signum)
{ {
if ( waiting == false ) { if ( waiting == false ) {
@ -144,6 +143,9 @@ void setup_sighandlers()
set_signal_handler(SIGINT, &handle_sigterm); set_signal_handler(SIGINT, &handle_sigterm);
set_signal_handler(SIGHUP, &handle_sighup); set_signal_handler(SIGHUP, &handle_sighup);
} }
#else
bool waiting = false;
bool libraryMustBeReloaded = false;
#endif #endif
uint64_t fileModificationTime(const std::string& path) uint64_t fileModificationTime(const std::string& path)
@ -422,7 +424,9 @@ int main(int argc, char** argv)
if ( monitorLibrary ) { if ( monitorLibrary ) {
curLibraryFileTimestamp = newestFileTimestamp(libraryPaths); curLibraryFileTimestamp = newestFileTimestamp(libraryPaths);
libraryMustBeReloaded += curLibraryFileTimestamp > libraryFileTimestamp; if ( !libraryMustBeReloaded ) {
libraryMustBeReloaded = curLibraryFileTimestamp > libraryFileTimestamp;
}
} }
if ( libraryMustBeReloaded && !libraryPaths.empty() ) { if ( libraryMustBeReloaded && !libraryPaths.empty() ) {

Loading…
Cancel
Save