Are reads/writes to floating point variables atomic?

asamson
Posts: 1
Joined: Tue Feb 13, 2018 6:33 am

Are reads/writes to floating point variables atomic?

Postby asamson » Tue Feb 13, 2018 6:46 am

Hi,

My application has two tasks. The first one updates a floating point variable and the other reads this variable. Do I need to protect access to this variable using a mutex or are read/write accesses atomic in this case?

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: Are reads/writes to floating point variables atomic?

Postby ESP_Angus » Thu Feb 15, 2018 3:44 am

If they're 32-bit floats, then any load/store is atomic.

If they're 64-bit doubles, then these are not atomic.

Who is online

Users browsing this forum: No registered users and 101 guests