I just want to know the tech inside.
Does it enumerate all key/value s or copy method is thread safe?
If I'm doing [dict copy](dict is a NSMutableDictionary) on a background thread, and update dict on main thread, will it crash?
code:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
for (int i = 0; i < 1000; i++) {
[self.dict addEntriesFromDictionary:@{@"key": [NSObject new], @"key3": [NSObject new]}];
}
});
for (int i = 0; i < 1000; i++) {
[self.dict copy];
}