浏览代码

handling race conditions for signal handler variable

clementinecomputing 6 年之前
父节点
当前提交
7424d23dec
共有 1 个文件被更改,包括 8 次插入8 次删除
  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