In C is “i+=1;” atomic?

后端 未结 12 2102
天命终不由人
天命终不由人 2020-12-28 12:58

In C, is i+=1; atomic?

12条回答
  •  天命终不由人
    2020-12-28 13:30

    No.

    The only operation guaranteed by the C language standard to be atomic is assigning or retrieving a value to/from a variable of type sig_atomic_t, defined in .

    (C99, chapter 7.14 Signal handling.)

提交回复
热议问题