Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: crashing problem due to buckyball timer exception in NSAppleScript class



On Dec 29, 2004, at 5:34 PM, IMD wrote:
synchronized(this)
{
// This creates a new NSAppleScript object to execute the script
NSAppleScript myScript = new NSAppleScript(script);

NSAppleScript is not listed among the thread-safe Cocoa facilities at <http://developer.apple.com/documentation/Cocoa/Conceptual/ Multithreading/Concepts/safety.html>. This means (1) that not only can you not use it from multiple threads at once, but also (2) that you also can't use it from any thread other than the main thread.


This applies to every piece of functionality that isn't thread-safe unless explicitly documented otherwise.

The presence of the synchronized block in your code strongly suggests to me that you're attempting to use NSAppleScript from a non-main thread. A simple synchronized block will not cause the code within it to execute on the main thread. It will just prevent another thread from entering a critical section that's synchronized on the same object.

  -- Chris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >crashing problem due to buckyball timer exception in NSAppleScript class (From: IMD <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.