How can i perform atomic operation of 64 bit variable on 32 bit system? this variable can be used anywhere like thread,signal handler and main routine. is there any way to do 64 bit variable atomic operation on 32bit system?
As these variables are normally stored in RAM, you don't need a 64bit architecture to create a 64 bit variable, as Cubbie mentioned, you can use std::atomic to declare any type of variable as atomic. also don't forget to include atomic header.
But <stdatomic.h> is added in C11 standard, but most compilers till now they have not updated. Here i have two doubts.
1) if compiler will support atomic operation,is atomic variable whatever i will declare can be of different size. like int64. whatever i saw on internet search, when ever declaring any variable as atomic, it will take it as int (which is 32bit wide). then how can int64 should be declare as atomic operation?
2) suppose, for old compiler version using C99 standard, which does not have any provision for atomic operation. is there any function exist to make operation as atomic one?