Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: potentially concurrent

14 views
Skip to first unread message

Scott Lurndal

unread,
Mar 3, 2017, 11:05:29 AM3/3/17
to
r...@zedat.fu-berlin.de (Stefan Ram) writes:
> The operations »signal = 2« and »signal = 3« below are both
> performed by a signal handler. So according to 1.10.1p19.2,
> they are potentially concurrent.
>
>#include <csignal>
>
>volatile std::sig_atomic_t gSignalStatus;

sig_atomic_t is volatile, so the additional volatile
keyword is redundant.

>
>void signal_handler( int signal )
>{ gSignalStatus =( signal = 2 )+( signal = 3 ); }
>
>int main() { ::std::signal( SIGINT, signal_handler); }
>
> »Two actions are potentially concurrent if
>
> - they are performed by different threads, or
>
> - they are unsequenced, and at least one is
> performed by a signal handler. (p19.2) «

The two assignments you
highlight will not be considered potentially concurrent
(unless, perhaps, they're autovectorized into a simd load and sum
instruction).
0 new messages