Re: CA_DEBUG_TRANSACTIONS=1
Re: CA_DEBUG_TRANSACTIONS=1
- Subject: Re: CA_DEBUG_TRANSACTIONS=1
- From: Kyle Sluder <email@hidden>
- Date: Thu, 06 Sep 2012 10:18:50 -0700
On Thu, Sep 6, 2012, at 09:09 AM, John MacMullin wrote:
> More or less.
>
> It appears that since the documentation in NSBundle does not state that
> its thread safe, it isn't.
This really isn't the whole story. NSBundle isn't thread-safe (don't
send it messages from multiple threads), but is probably safe to use
from non-main threads, as long as it's only used from one thread.
By contrast, you should NEVER load a nib from a background thread.
AppKit is very dependent on running on the main thread.
>
> From Core Animation tho, it would appear that executing a CATransaction
> flush may have resolved my original message, but perhaps not the problem.
>
> If I read this correctly, this updates the layers, which wouldn't
> otherwise be updated on a background thread.
Doubtful; +flush pushes values from the model tree to the presentation
tree, but it doesn't actually close a transaction. You'd still have an
open transaction when the thread was exited.
>
> It would seem that if I call a non-thread safe function in a background
> thread, i.e., from an NSOperationQueue, that a compile or other error
> should result.
In order to know that you're doing this, the compiler would need to be
able to simulate execution of your code. Given the design of the C type
system and program execution model, this is an impossibility. You cannot
build a compiler with this functionality that will also allow
compilation of all valid C programs. You could design a language with
this safety feature (for example, a "background" attribute built into
the type system), but there would then exist valid programs that the
compiler would reject. C prefers to let you shoot yourself in the foot
rather than restrict you from writing programs simply because the
compiler cannot prove they are correct.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden