• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSOperationQueue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOperationQueue


  • Subject: Re: NSOperationQueue
  • From: has <email@hidden>
  • Date: Sat, 20 Sep 2008 18:39:00 +0100

Mike Fischer wrote:

12) Finally, my -calculateWorksheetRow looks like:
- (void) calculateWorksheetRow {
	// column after column after column ...

I didn't follow this complete discussion thread but I kind of read between the lines that your operation is actually calling a different process (Microsoft Excel) using AppleScript? If so you will need to rethink your strategy I think. To my knowledge AppleScript is not thread safe

IIRC, AppleScript itself can be used on cooperative threads if you're careful and know what you're doing, but preemptive threads are right out. However, since the goal seems to be to control Excel directly from ObjC, I already suggested to the OP that he switch to appscript, which is thread-safe and should work fine with Excel.



and  running multiple AppleScripts targeting the same app in parallel
(which would be the reason for using an NSOperationQueue in the first
place) will at best not gain you any advantage and at worst crash
yourself and/or Excel.


Sending events from multiple threads won't crash Excel, but could easily interfere with each others' activities due to the total lack of locking/transaction support/object ownership in scriptable applications (one of several significant deficiencies of Apple event IPC). Best to deal with a single application from a single thread in a single process at a time, and (particularly if it's a long-running series of operations) warn users not to run other AppleScripts or do anything else to interact with that application while it's working.

...

Getting back to the main discussion of the OP's threading/ NSOperationQueue problems, perhaps it would help if he backs up a bit and explains in general terms what he's trying to achieve, rather than focus on individual details of how he's currently trying to do it? That way, folks might be able to suggest a better overall solution, rather than getting bogged down in the details of the current, potentially misconceived, approach.

HTH

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

_______________________________________________

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


  • Prev by Date: Re: Finding other apps' paths - deterministically!
  • Next by Date: How to create a new window initially zoomed to the maximal size?
  • Previous by thread: Re: NSOperationQueue
  • Next by thread: Re: NSOperationQueue
  • Index(es):
    • Date
    • Thread