At 13:38 -0500 24/11/08, Michael Ash wrote:
No, it's not a general consensus. It's something I discovered on my
own, and posted about it here. I haven't received any overall
confirmation that it's broken, but my simple test project was able to
reliably crash on perhaps half a dozen different hardware
configurations. (And fail to crash on quite a few more.)

If you like, you can go through the original thread here and come to
your own conclusions:

http://www.cocoabuilder.com/archive/message/cocoa/2008/10/30/221452

If you want to know more about it, please feel free to ask me.

I looked through this a bit further and am sadly coming to the conclusion that you're right, under some (quite easy to duplicate) circumstances, the NSInvocationOperation appears to be executed by two worker threads and chaos ensues.

As near as I can tell, it is safe if (and perhaps only if) addOperation only happens on the main thread (or perhaps only happens on a single thread).

As soon as addOperation happens on multiple threads, even if the queue is set to setMaxConcurrentOperationCount = 1, and even if no queue ever executes more than a single NSInvocationOperation, then the problem appears.

I adjusted your test such that a new Tester object (with new NSOperationQueue) is created each time so only a single operation is ever executed for any given NSOperationQueue and it still results in [NSInvocationOperation start] being called twice for the same operation.

The only saving grace is that performSelectorOnMainThread:@selector(addOperation:), or only calling the addOperations from the main thread resolves the problem, which means my recent use of NSOperation in soon to be shipping code should be safe, but I certainly would not be recommending NSOperationQueue be used as it stands and would not have used if I knew what I know now.

Very sad.
   Peter.

--
              Keyboard Maestro 3 Now Available!
                Now With Status Menu triggers!

Keyboard Maestro <http://www.keyboardmaestro.com/> Macros for your Mac
<http://www.stairways.com/>           <http://download.stairways.com/>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to