I'm working on a relatively simple iPhone application that has a multi-round Timer with a number of settings such as the number of rounds and round length. We allow certain settings to be upated while the timer is running which means the timer may be reading from the same memory that the settings are writing. There are no critical sections of code where multiple threads will be executing at the same time but code from the settings may be trying to write memory the timer is reading from.
In terms of a simple example, let's say we a global variable foo and there is an NSTimer method which looks as follows:
-(void)timerTick { NSString *x = foo; }
then in the settings code, we do this while the timer is running:
foo = @"test";
Will it be enough to make foo atomic in this application or do we need some kind of locking scheme?
Thanks.