• 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: Getting the main run loop to call a selector
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the main run loop to call a selector


  • Subject: Re: Getting the main run loop to call a selector
  • From: Bruno Gaufier <email@hidden>
  • Date: Fri, 12 Sep 2003 11:27:23 +0200

On Friday, September 12, 2003, at 10:10 AM, Tim Hewett wrote:

I'm having some problems with multithreading and Cocoa, like opening
and closing drawers from subthreads (sometimes they open, sometimes
they don't). These problems don't happen when the main thread, i.e. the
one which responds to menus and buttons etc., performs these actions.
So I'm thinking that it would be best to have the main thread do these
things when asked to by the subthread, hoping that this behaviour will
become reliable because of this.

Is there a way to post some kind of event, notification, message or
whatever to the main thread to have it call a selector on an object?
Yes, the performSelectorOnMainThread: method of the NSObjectClass class.

Maybe you can also use a NSConnection to communicate between your threads (this is
explained in the cocoa documentation / resources management / multithreading with
code snippets).

--
Bruno Gaufier
----
email@hidden
email@hidden

http://perso.club-internet.fr/bgaufier/
_______________________________________________
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.

  • Follow-Ups:
    • splash screen
      • From: Damien Pacaud <email@hidden>
References: 
 >Getting the main run loop to call a selector (From: Tim Hewett <email@hidden>)

  • Prev by Date: Another newbie Q - tracking mouse position.
  • Next by Date: splash screen
  • Previous by thread: Getting the main run loop to call a selector
  • Next by thread: splash screen
  • Index(es):
    • Date
    • Thread