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