Prechádzať zdrojové kódy

handling race conditions for signal handler variable

clementinecomputing 6 rokov pred
rodič
commit
7424d23dec
1 zmenil súbory, kde vykonal 8 pridanie a 8 odobranie
  1. 8 8
      busunit/common/common_defs.c

+ 8 - 8
busunit/common/common_defs.c

@@ -677,17 +677,17 @@ int test_and_init_device(int fd, device_test_vector *vec, char *diag)
 //------------------------------- WATCHDOG TIMER and other SIGNAL HANDLERS -------------------------------
 //========================================================================================================
 
-volatile int hup_request_status = 0;
+//volatile int hup_request_status = 0;
+volatile sig_atomic_t hup_request_status = 0;
 
-void request_hup(char *fmt, ...)
-{
-    va_list ap;
+void request_hup(char *fmt, ...) {
+  va_list ap;
     
-    hup_request_status = 1;
+  hup_request_status = 1;
 
-    va_start(ap, fmt);
-        vprintf(fmt, ap);
-    va_end(ap);
+  va_start(ap, fmt);
+  vprintf(fmt, ap);
+  va_end(ap);
 }
 
 //Our signal handlers and standard message handlers will OR these bits into exit_request_status