Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7667911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:13:26+00:00 2026-05-31T15:13:26+00:00

So I know that NSManagedObjects are not thread safe and managedObjectIDs are, and we

  • 0

So I know that NSManagedObjects are not thread safe and managedObjectIDs are, and we need a separate managedObjectContext per thread. But recently I had an issue when I was doing some core data changes in the background (had a separate runloop thread for this) and performSelectorOnThread: method sometimes was simply not invoked on this runloop thread. It turned out that the reason was that I was doing

    [someObject.managedObjectContext save:&error]

on this runloop thread and “someObject” was created on the main thread. But it would only “hung” runloop thread once in a while. So the question is what really happens if you try to save context in a different thread. I’m just looking for a deeper understanding, thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:13:28+00:00Added an answer on May 31, 2026 at 3:13 pm

    From https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/CoreDataFramework/Classes/NSManagedObjectContext_Class/NSManagedObjectContext.html :

    Core Data uses thread (or serialized queue) confinement to protect
    managed objects and managed object contexts (see “Concurrency with
    Core Data”). A consequence of this is that a context assumes the
    default owner is the thread or queue that allocated it—this is
    determined by the thread that calls its init method. You should not,
    therefore, initialize a context on one thread then pass it to a
    different thread. Instead, you should pass a reference to a persistent
    store coordinator and have the receiving thread/queue create a new
    context derived from that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that it's a subject that can raise a lot of debate, but
I know that I should put all the html elements in body tag, but
I know that this has already been asked here but the answer (using a
I know that design patterns is generally something that's connected to OO programming, but
I know that this may be common knowledge, but is there a way to
I know that |DataDirectory| will resolve to App_Data in an ASP.NET application but is
I know that one of the differences between classes and structs is that struct
I know that exceptions have a performance penalty, and that it's generally more efficient
We know that behind the scenes, the ASP.NET MVC framework will use reflection to
I know that one can define an 'expected' exception in JUnit, doing: @Test(expect=MyException.class) public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.