With sim performance ON, value may be equal to nil or equal to @"FOO" depending on if line 3 executed before the internal barrier_async block executed.
With sim performance OFF, value is always equal to nil. Mutations after line 2 are not acknowledged.
The code above is incorrect anyways (you wouldn't expect it to work) -- but we still need to honor the behavior of NSUserDefaults. You could emulate this bug using -setObject:forKey: with a mutable object.
dispatch_barrier_async works great for this project, except for the following situation:
The code above is incorrect anyways (you wouldn't expect it to work) -- but we still need to honor the behavior of NSUserDefaults. You could emulate this bug using -setObject:forKey: with a mutable object.