An open API service indexing awesome lists of open source software.

https://github.com/mmower/testcoredataconcurrency

Tests new CoreData concurrency approach.
https://github.com/mmower/testcoredataconcurrency

Last synced: about 2 months ago
JSON representation

Tests new CoreData concurrency approach.

Awesome Lists containing this project

README

        

The idea was to write something to test the new GCD based concurrency options in
CoreData for 10.7. In particular to test that it's safe to create & query from
queues and the main thread at the same time.

We create a main managed object context using NSMainQueueConcurrencyType then
schedule a crap load of blocks onto a concurrent queue. We also start a timer
that will give the main thread periodic opportunties to mess things up.

The blocks are of two types:

1) Add new objects using a child MOC and saves the child MOC
2) Count objects using a child MOC

The timer callback

1) Counts objects
2) Adds a new object via the main MOC and saves the main MOC

The idea is to tease out interference issues.

We have already discovered that using NSPrivateQueueConcurrencyType for the main
MOC is problematic if anything is done from the main thread. It seems that this
somehow stops the queue as no more blocks are processed. Switching to using
NSMainQueueConcurrencyType solved this problem. That's perhaps its purpose in
life.