Reputation: 942
I am having a structure of parent/child relationship context.
The parent is main context and the child is private concurrent context.
when the child does some changes and do save
. The main context (object) receives the notification and do NSManagedObjectContextDidSave
.
The problem is that I am wondering if this action is thread safe? because even it's wrapped in is't own context/thread (inside mainContext.performBlock
), the other thread - child concurrent thread for example, can do the fetch. Will it corrupt the data when these 2 actions happen at exact time?
Upvotes: 1
Views: 101
Reputation: 41
performBlock : synchronously performs the block on the context's queue. and is not thread safe in case of saving multiple records.
performBlockAndWait: synchronously performs the block on the context's queue. May safely be called subroutine.
Upvotes: 1