sdbus_event loop state mark as volatile?

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

 



The libsystemd bus event loop is:


        while (e->state != SD_EVENT_FINISHED) {
                r = sd_event_run(e, (uint64_t) -1);
    
But since e->state is changed by another thread it
should be marked volatile to avoid compiler thinking
the state doesn't get changed.


diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index 5adbceeb0247..b7be2472a398 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -90,7 +90,7 @@ struct sd_event {
 
         uint64_t iteration;
         triple_timestamp timestamp;
-        int state;
+        volatile int state;
 
         bool exit_requested:1;
         bool need_process_child:1;
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux