Re: Using NSTimer to call the main thread
Re: Using NSTimer to call the main thread
- Subject: Re: Using NSTimer to call the main thread
- From: email@hidden
- Date: Thu, 27 Mar 2003 10:36:15 -0800 (PST)
wouldnt it be equally possible to pass a reference to the UI controller to the
secondary thread and call updateValueNow: directly?
On Thu, 27 Mar 2003 10:35:36 -0800 (PST), Peter Robinson wrote:
>
>
I am trying to communicate with the main thread in order to update
>
the user interface.
>
>
From my secondary thread, I can install a one-off NSTimer on the
>
run-loop of the main thread, like this:
>
>
NSTimer *timer = [NSTimer timerWithTimeInterval: 0
>
target: self selector: @selector(updateValueNow:)
>
userInfo: nil repeats: NO];
>
>
[mainRunLoop addTimer: timer forMode: NSDefaultRunLoopMode];
>
>
which seems to work well enough. But I am worried that it isn't
>
legal to install a timer on a run-loop from another thread. Can I do
>
this? If not, what is the simplest way to get code called on the
>
main thread? I am using 10.1.
>
>
Thanks,
>
>
Peter
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives: <a
href="
http://mail.canada.com/jump/http://www.lists.apple.com/mailman/listinfo/cocoa-dev">
http://www.lists.apple.com/mailman/listinfo/cocoa-dev</a>
>
Do not post admin requests to the list. They will be ignored.
__________________________________________________________
Get your FREE personalized e-mail at
http://www.canada.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.