??? 01/08/07 15:48 Read: times |
#130431 - Don't disable Responding to: ???'s previous message |
Jan Waclawek said:
To C-lovers, :-)
Is there any chance to get the (any) C-compiler "take care" of "non-atomicity" of multibyte variables, so that there is no need to juggle with interrupt enable? Same as assembly, sometimes we take care of it without disabling interrupts by recognizing when an ISR has modified the multibyte variable. There are several ways to do this depending on how the variable changes, but one generic method is to associate a 'dirty' bit with the variable. The ISR always sets the dirty bit when it modifies the variable. The non-ISR code clears the dirty bit, reads the variable, then checks the dirty bit and if set, repeats until it gets a clean read. Standard C does not provide any means for what you are asking. Some extended Cs might. |