3Squared / SQKDataKit

Lightweight Core Data helper to reduce boilerplate code.
MIT License
19 stars 6 forks source link

Prevent deadlock when the operation is being run on the main thread #82

Open blork opened 8 years ago

blork commented 8 years ago

If an SQKOperation is run on the main thread using [operation start] then there is a possibility of deadlock when dispatch_async(dispatch_get_main_queue(), ...) is used. This change checks the current queue and conditionally executes the merge block on the appropriate one.

In production code this doesn't happen, since operations are usually run on a background queue. When running tests it is much more likely. This should fix some issues that break test runs.