Re: Do I need to use Distributed Objects or not?
Re: Do I need to use Distributed Objects or not?
- Subject: Re: Do I need to use Distributed Objects or not?
- From: Dave Camp <email@hidden>
- Date: Wed, 9 Feb 2005 08:31:15 -0800
On Feb 9, 2005, at 4:05 AM, Michael Becker wrote:
Hi all!
I need to do several thread-worthy little tasks in my application,
e.g. loading data from a server or loading several images (much like
iPhoto's import). I think I know the basic idea of threading in Cocoa
but I was just wondering what exactly I need. I do not want to do it
more complicated than necessary.
From Apple's site:
http://developer.apple.com/documentation/Cocoa/Conceptual/
Multithreading/articles/ThreadComm.html#//apple_ref/doc/uid/TP40001475
From the local docs:
<file:///Developer/ADC Reference Library/documentation/Cocoa/
Conceptual/Multithreading/index.html#//apple_ref/doc/uid/10000057i>
The one thing I discovered the hard way about DO is that the docs don't
discuss exactly when messages will be run on the target thread. I
assumed they would be run at idle time on the target thread's runloop,
which is not the case. They appear to be run whenever that thread makes
an API call that might run the event loop as a side effect or cause
something to cause mach messages to be dispatched. In other words,
depending on what API's you are currently executing in the target
thread, a DO message might be executed essentially as an interrupt or
preemptively (for lack of better terms).
The older Xcode 1.2 docs used to have some sample code in them for
using a custom NSNotificationCenter and a NSMachPort to send
NSNotifications between threads that would run at idle time, but that
seems to have been removed in the latest docs. I've seen the same
technique used by others as well. I can send you some source if you
want.
Dave
_______________________________________________
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