Re: Getting the main run loop to call a selector
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.