Friday, July 9, 2021

Why we need volatile

 The volatile keyword is a type qualifier which tells compiler to not to optimize/cache any operation with these variable.


Value of this variable can change between two read or two write by external forces or event


The volatile keyword is mainly used where we directly deal with GPIO, interrupt or flag Register. It is also used with a global variable or buffer which shared between the threads.


No comments:

Post a Comment