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

Add a blocking variant of the nested save method #313

Conversation

tonyarnold
Copy link
Contributor

As per the discussion in #297 — this is not what you'd normally want to do, but there's a use-case for it.

blackgold9 and others added 3 commits October 15, 2012 23:15
As per the discussion in magicalpanda#297 — this is not what you'd normally want to
do, but there's a use-case for it.
@mac-cain13
Copy link

Is this working for you? When I call your method from the main thread and the context has an new object inserted I will end up with a deadlock. I'm blocking the mainthread waiting for the save to complete and the save is dispatching some stuff to the maintread and is waiting for that to finish to complete the save action...

@blackgold9
Copy link
Contributor

Tony, have you hit the deadlock mac-cain13 is talking about? If not, it does seem this method will be handy for some cases, and we should merge it in.

@tonyarnold
Copy link
Contributor Author

@blackgold9 — no, I have not. AFAIK the included test case runs from the main thread so we'd be seeing it when running the unit tests as well, wouldn't we? I'll find some time to write up a further test case — unless @mac-cain13 can provide one that I can use?

@batkuip
Copy link

batkuip commented Nov 26, 2012

Why the group wrapping? What's wrong with performBlockAndWait?

On Tue, Nov 27, 2012 at 7:15 AM, Tony Arnold notifications@github.comwrote:

@blackgold9 https://github.com/blackgold9 — no, I have not. AFAIK the
included test case runs from the main thread so we'd be seeing it when
running the unit tests as well, wouldn't we? I'll find some time to write
up a further test case — unless @mac-cain13https://github.com/mac-cain13can provide one that I can use?


Reply to this email directly or view it on GitHubhttps://github.com//pull/313#issuecomment-10734161.

Thomas van der Heijden
IT Consultant | TvdH Consulting
0410 153 224 | thomas@mirrin.net
LinkedIn: http://au.linkedin.com/in/thomasvanderheijden

@tonyarnold
Copy link
Contributor Author

I need to do some reading on this. I was under the (mistaken?) impression that performBlockAndWait switched to the thread the NSManagedObjectContext was created on, not the current thread. In re-reading the documentation, it appears that this is indeed what happens, but that it's blocking all the same.

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.

4 participants