Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper Function for passing managed objects between threads #5

Merged
merged 4 commits into from
Apr 19, 2011
Merged

Helper Function for passing managed objects between threads #5

merged 4 commits into from
Apr 19, 2011

Conversation

KingOfBrian
Copy link
Contributor

Added a Managed Object Proxy function to help pass Managed Objects between threads:

[ActiveRecordHelpers performSaveDataOperationInBackgroundWithBlock:^(NSManagedObjectContext *context) {
[[managedObject inContext:context] doAnExpensiveOperation];
}];

Seems to work well, but 2 concerns:

  1. I'm calling [managedObject objectID] off of managedObjects thread. Does not seem like an issue and hasn't caused a problem but is not explicitly recommended.

  2. Error handling is minimal. I just log an error at the moment.

Would appreciate your thoughts!

Brian King added 2 commits April 1, 2011 15:02
…tThread rather than defaultContext. Fixed compiler warning for ARLog when used in a class method.
@KingOfBrian
Copy link
Contributor Author

Here's some further integration for contextForThread if interested. I haven't kicked the tires too hard though, but the change seems pretty simple. Only further integration I could see is the block functions, but to be honest, I like the block functions using a fresh context for operations.

Thanks a ton for this library.

@KingOfBrian
Copy link
Contributor Author

Here's a bug fix. The deleteEntity one is a bad one, drove me nuts trying to figure out why my bindings were all borked on deletion. Also, I'm looking at error handling and it would be great to be able to route errors to the completion block of the helper as well as a generic handler ala delegation or notification. I'll marinate on it for a few, but thought I'd see what you think.

@casademora
Copy link
Member

Thanks for fixing that. I've been rather busy with other projects and haven't had a whole lot of time to test out your change...I do intend on pulling it though :)

@KingOfBrian
Copy link
Contributor Author

No worries. I'm integrating this into a mac app, so I'll continue patching
as/if I find new bugs. Have you looked at the new Core Data features in
10.7 by the way?

On Sun, Apr 10, 2011 at 3:18 PM, casademora <
[email protected]>wrote:

Thanks for fixing that. I've been rather busy with other projects and
haven't had a whole lot of time to test out your change...I do intend on
pulling it though :)

Reply to this email directly or view it on GitHub:

https://github.com/magicalpanda/activerecord-fetching-for-core-data/pull/5#issuecomment-980709

@casademora
Copy link
Member

I have, but, since it's all NDA, I'm not allowed to comment here :) You'll be seeing more from me when it is made public.

@KingOfBrian
Copy link
Contributor Author

Hah, no worries although I'm in the beta too.

I have another fix coming for NSFileManager. Changed to from
defaultManager to alloc / init, since defaultManager isn't thread safe.
Doubt it would cause an issue, but just incase.

On Mon, Apr 11, 2011 at 9:40 AM, casademora <
[email protected]>wrote:

I have, but, since it's all NDA, I'm not allowed to comment here :) You'll
be seeing more from me when it is made public.

Reply to this email directly or view it on GitHub:

https://github.com/magicalpanda/activerecord-fetching-for-core-data/pull/5#issuecomment-983619

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants