Re: sdbus_event loop state mark as volatile?

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

 



On Do, 05.09.19 10:46, Stephen Hemminger (stephen@xxxxxxxxxxxxxxxxxx) wrote:

> 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.

None of systemd's libraries are thread safe. They are written in a
threads-aware style though. This means you should only use a specific
context object from a single thread at a time, and need to do your own
locking around it if that single thread shall change all the
time. systemd doesn't keep global state generally, which means doing
your own locking around the sd_xyz objects should suffice and work
reasonably well.

Lennart

--
Lennart Poettering, Berlin
_______________________________________________
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