Skip to content

Instantly share code, notes, and snippets.

@alanjrogers
Created October 4, 2011 04:23
Show Gist options
  • Select an option

  • Save alanjrogers/1260899 to your computer and use it in GitHub Desktop.

Select an option

Save alanjrogers/1260899 to your computer and use it in GitHub Desktop.

Revisions

  1. Alan Rogers revised this gist Oct 4, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion CoreDataThreadingQuestion.m
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    __block NSManagedObject* object = nil;

    [privateQueueContext performBlockAndWait:^{
    object = [SomeClass methodThatExecutesFetchRequestUsingContextReturningObject:privateQueueContext];
    object = [SomeClass methodThatExecutesFetchRequestReturningObjectUsingContext:privateQueueContext];
    }];

    // Is it safe to use object here?
  2. Alan Rogers revised this gist Oct 4, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion CoreDataThreadingQuestion.m
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    __block NSManagedObject* object = nil;

    [privateQueueContext performBlockAndWait:^{
    object = [SomeClass methodThatExecutesFetchRequestUsingContext:privateQueueContext];
    object = [SomeClass methodThatExecutesFetchRequestUsingContextReturningObject:privateQueueContext];
    }];

    // Is it safe to use object here?
  3. Alan Rogers created this gist Oct 4, 2011.
    9 changes: 9 additions & 0 deletions CoreDataThreadingQuestion.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    __block NSManagedObject* object = nil;

    [privateQueueContext performBlockAndWait:^{
    object = [SomeClass methodThatExecutesFetchRequestUsingContext:privateQueueContext];
    }];

    // Is it safe to use object here?

    NSLog(@"object: %@", object);