Re: Threads, Distributed Objects, and NSUndoManager
Re: Threads, Distributed Objects, and NSUndoManager
- Subject: Re: Threads, Distributed Objects, and NSUndoManager
- From: "John C. Daub" <email@hidden>
- Date: Sat, 16 Oct 2004 21:43:40 -0500
on 10/16/04 8:47 PM, m at email@hidden wrote:
>
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.
Ok.
It is probably overkill for me. I've been doing more reading on threading
strategies to take, and it's looking more and more like this is too much for
my needs. It could be ok, but given the undo issues I just have to find
another approach.
>
>> 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.
Oh ok, I got the impression there was some technical reason for it.
Thanx for the clarifications.
>
By the way I'm by no means an expert at threading in Cocoa, just
>
sharing some of the techniques I developed for myself.
It's been a big help. Thank you. :-)
At this point I'm going to try to see if I can solve it with a simple
NSThread approach, but if that fails I'll probably use QpThread to solve it.
Off to experiment...
--
John C. Daub }:-)>=
<
mailto:email@hidden> <
http://www.hsoi.com/>
"Perfection is achieved, not when there is nothing more to add, but
when there is nothing left to take away." - Antoine de Saint-Exupery
_______________________________________________
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