Re: threads and GUI
Re: threads and GUI
- Subject: Re: threads and GUI
- From: Steven Winston <email@hidden>
- Date: Tue, 1 Sep 2009 03:26:07 -0500
Honestly, if your main concern is cross-platform UI + code. I'd
recommend going with an abstraction layer ala Qt. If you want to
follow the paradigms set forth by each operating system you're
shooting for (i.e. .net uses Model-View-Presenter, most everything
Apple especially cocoa is designed for Model-View-Controller), then
having the UI be on the main thread should be pretty easy to design
for as that's kinda the proper way to do things in both windows land
and apple land. Proper design *should* allow you to have a very
nicely cross-platform UI without worrying about which user mode thread
it's being called from. If that's not possible, (as we all live in
the real world), then see if Qt will help you solve the problem; it's
built for things like this.
On Tue, Sep 1, 2009 at 3:10 AM, Jean-Daniel Dupas<email@hidden> wrote:
> Not better. All UI events have to be performed on the same thread. On Snow
> Leopard, you should use
> CFRunLoopPerformBlock(CFRunLoopGeMain(), kCFRunLoopModeDefault, ^{
> // Your UI code here.
> });
>
> On prior OS versions, you have to find a way to schedule your work on the
> main thread (use cocoa method -[NSObject performOnMainThread:], add
> observers or timer to the main CFRunLoop, etc…).
>
> Le 1 sept. 2009 à 09:59, john smith a écrit :
>
> Thanks.
>
> How about calling cocoa ui calls, like NSAlert, from the thread then. Is
> that doable? (while still running the "main gui" as carbon).
>
>
> Thanks,
>
> Michael Olsen
>
>
> ________________________________
> Subject: Re: threads and GUI
> From: email@hidden
> Date: Tue, 1 Sep 2009 09:57:12 +0200
> CC: email@hidden; email@hidden
> To: email@hidden
>
> Yes, it's a carbon UI.
>
> Carbon UI can't be called from any other thread but the main thread. You
> might be able to setup a CFRunLoop to get a quasi-multithreading working.
>
> Do you think it would be better to use the MP calls then?
>
> They are compatibility wrappers for pthreads. Doesn't make a difference.
>
> (And no, turning it into a cocoa UI is not an option :-))
>
> Then say bye-bye to your plug-in in the future: Carbon is dead, e.g. it is
> not supported by 64 bit.
>
> Markus
> ________________________________
> Share your memories online with anyone you want anyone you
> want. _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
> -- Jean-Daniel
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Coreaudio-api mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden