Use volatile for global variables
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 1m26s

These globals are accessed in signal handling, so they need to be
volatile.

Resolves #4
This commit is contained in:
Stephen Seo 2024-09-21 14:41:02 +09:00
parent 1deec0c564
commit 1416a47e87
2 changed files with 4 additions and 4 deletions

View file

@ -16,7 +16,7 @@
#include "globals.h"
int_fast8_t C_SIMPLE_HTTP_KEEP_RUNNING = 1;
int_fast8_t C_SIMPLE_HTTP_SIGUSR1_SET = 0;
volatile int_fast8_t C_SIMPLE_HTTP_KEEP_RUNNING = 1;
volatile int_fast8_t C_SIMPLE_HTTP_SIGUSR1_SET = 0;
// vim: et ts=2 sts=2 sw=2

View file

@ -20,8 +20,8 @@
// Standard library includes.
#include <stdint.h>
extern int_fast8_t C_SIMPLE_HTTP_KEEP_RUNNING;
extern int_fast8_t C_SIMPLE_HTTP_SIGUSR1_SET;
extern volatile int_fast8_t C_SIMPLE_HTTP_KEEP_RUNNING;
extern volatile int_fast8_t C_SIMPLE_HTTP_SIGUSR1_SET;
#endif