• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Threads and messages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threads and messages


  • Subject: Re: Threads and messages
  • From: Marco Binder <email@hidden>
  • Date: Tue, 11 Mar 2003 15:28:31 +0100

Thanks for the pointer to performSelectorOnMainThread! I guess I bite the bullet and make 10.2 a prerequisite. In my opinion, everyone should own it anyways and its going to be a scientific app, so I hope 10.2 is a good presumption.

Jeff, thanks for your additional suggestions. All of them sound very reasonable and I m sure I ll apply them in one or the other project! actually, I tried to do the GUI work in the secondary thread (right now, its just reloading a NSTableView datasource and updating some selection), but as I get more threads, the app used to crash with signal 10 or 11, absolutely randomly. So I guess, I might want to restrict the threaded work on ONLY the calculations.

Thanks,

Marco



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.


--
|\ /| 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.

References: 
 >Re: Threads and messages (From: Jeff Disher <email@hidden>)

  • Prev by Date: Re: Toolbar hide/show button
  • Next by Date: Re: Toolbar hide/show button
  • Previous by thread: Re: Threads and messages
  • Next by thread: RE: Threads and messages
  • Index(es):
    • Date
    • Thread