[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/5] pkd_daemon.c: mark `pkd_ready` field as volatile


From 3a3aad6e1808a0f8487d4231a1bcf94daaa02f10 Mon Sep 17 00:00:00 2001
From: Jon Simons <jon@xxxxxxxxxxxxx>
Date: Sat, 13 May 2017 00:15:43 -0400
Subject: [PATCH 2/5] pkd_daemon.c: mark `pkd_ready` field as volatile

Otherwise, compilers may optimize away the load required
for the busy-loop spin in `pkd_start` to terminate.

Signed-off-by: Jon Simons <jon@xxxxxxxxxxxxx>
---
 tests/pkd/pkd_daemon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/pkd/pkd_daemon.c b/tests/pkd/pkd_daemon.c
index 61582b5a..44cd0ce3 100644
--- a/tests/pkd/pkd_daemon.c
+++ b/tests/pkd/pkd_daemon.c
@@ -58,7 +58,7 @@ static struct {
     int rc;
     pthread_t tid;
     int keep_going;
-    int pkd_ready;
+    volatile int pkd_ready;
 } ctx;
 
 static struct {
-- 
2.13.2


Archive administrator: postmaster@lists.cynapses.org