Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: GUI and IAC and threads
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GUI and IAC and threads



Is there some alternative that will always work from the main thread? How do you enable apple events, or CFMessagePorts or something, in the main thread while the open or save dialog is up. This is from a plugin to the host application, so the core code can not be changed.

BTW, are apple events faster than CFMessagePorts? I had the timeout for my apple events set to 30 ticks with no problem, but the CFMessagePort timed out after 2.0 seconds.

Thanks
Eric

The question is how safe is accessing and manipulating the GUI from preemptive threads?

It's not. HIToolbox is not thread-safe (with a few exceptions: posting Carbon events, using the Notification Manager).

What if you can assume that the host process is always in the background?

There's still no guarantee. The main thread could still be in HIToolbox for some other reason than user interaction.

What if I access information from a thread but always do manipulation through apple events?

There's still no guarantee when you're using multiple threads. It could happen, for example, that the main thread might be inside DisposeWindow. If you try to access information about that window from a second thread, you could crash if the Window Manager's data structures aren't in a consistent state.

-eric
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: GUI and IAC and threads (From: Eric Schlegel <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.