Re: Threads, Distributed Objects, and NSUndoManager
Re: Threads, Distributed Objects, and NSUndoManager
- Subject: Re: Threads, Distributed Objects, and NSUndoManager
- From: m <email@hidden>
- Date: Sat, 16 Oct 2004 18:47:45 -0700
On Oct 16, 2004, at 6:24 PM, John C. Daub wrote:
If I don't need to use DO, then under what circumstances would I want
to use
DO? And in terms of convenience, what exactly is it making more
convenient
and how so?
If you have a scenario that requires lots of cross-thread
communication, using DO relieves you from having to worry about most
thread safety issues. But in your case, it's probably overkill, and as
you seemed to have found, has some short comings.
Here's a strategy: have your main thread allocate the data object and
pass it to your worker thread (without retaining a reference to it),
Why would I not want to retain a reference to it? And what would
happen if I
did?
There's no technical reason, it's easier to enforce thread safety if
you don't have a reference to the data object. If you don't have a
reference to the object, you're unlikely to inadvertently do something
with it that violates thread safety.
By the way I'm by no means an expert at threading in Cocoa, just
sharing some of the techniques I developed for myself.
Cheers,
_murat
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden