Re: Quandary : NSAppleScript ties up main thread
Re: Quandary : NSAppleScript ties up main thread
- Subject: Re: Quandary : NSAppleScript ties up main thread
- From: Shane Stanley <email@hidden>
- Date: Tue, 11 Oct 2011 13:01:52 +1100
On 11/10/2011, at 10:41 AM, Jerry Krinock wrote:
> However, any invocation to NSAppleScript must occur on the main thread
From the 10.6 release notes:
> Thread Safety
> OSA and AppleScript are now thread-safe: they may be safely called on a non-main thread or from multiple threads without any locking in the client code. This also applies toNSAppleScript. This does not mean that AppleScript is totally concurrent: AppleScript uses locking to ensure that any single connection (a ComponentInstance) will only run on one thread at a time. Because of the size of the locking granularity, trying to manipulate the same script from multiple threads at once may still be subject to race conditions, and is not recommended.
>
> Before using a scripting component on a background thread, developers should test the component’s “thread-safe” bit (cmpThreadSafe in the ComponentDescription’scomponentFlags.) Test the generic component before using OSA on a background thread, and then test the specific language component before using it on a background thread.
--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden