Re: Threads and messages
Re: Threads and messages
- Subject: Re: Threads and messages
- From: Jeff Disher <email@hidden>
- Date: Tue, 11 Mar 2003 08:56:14 -0500
Well, if you want an ugly hack you could use the
NSDistributedNotificationCenter but it is supposed to be slow since it
informs every thread in ever process on the machine what happened.
If your main thread can block while the others perform their
computation (probably not what you want) then it is pretty trivial to
synchronize with a NSLock.
If you only need 10.2 as a deployment platform you can look at the
method to post a notification on the main thread, it should do exactly
what you want.
Of course, you could also have the secondary threads perform the UI
update themselves before they die as long as you are careful.
Probably the best way, however, (if you need 10.1, that is) is to use a
NSMessagePort or something similar. I found that approach works pretty
well, personally, and it isn't as big as full-blown DO.
Hope that helps,
Jeff.
On Tuesday, March 11, 2003, at 08:36 AM, Marco Binder wrote:
I have a couple of computational threads, that dont need to talk to the
main thread. But: they should really inform the main threrad, when they
are done and will exit. Is there another way of doing so rather than
using DO?
If the main thread registers for the threads notifications, the docs
say, the notification will be processed from within the exiting thread-
thats not what I want since I d have to do some GUI element update...
Marco
--
|\ /| E-Mail: email@hidden WWW: www.marco-binder.de
| \/ | Telefon: 07531 / 94 19 94 Fax: 07531 / 94 19 92
| |ARCO Snail-Mail: Banater Str. 3 - 78467 Konstanz
BINDER _____________________________________________________
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
Jeff Disher
President and Lead Developer of Spectral Class
Spectral Class: Shedding Light on Innovation
http://www.spectralclass.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.