On Aug 27, 2009, at 8:18 AM, McLaughlin, Michael P. wrote:

I'm wondering about the timing of NSOperationQueue emptying.

In my Objective-C++ (Leopard) app, I have one opQueue of operations and the very last thing each operation does is enqueue the results of a computation
back to the main thread.

NSPointerArray *ptr = [NSPointerArray pointerArrayWithStrongObjects];
[ptr addPointer:&PL];
[mainQueue enqueueNotification:[NSNotification
notificationWithName:@"compNotif"
   object:ptr]
   postingStyle:NSPostNow];
} // end of main()

If this is the main thread's NSNotificationQueue, you can only use it from the main thread, since it's listed as being unsafe to use from multiple threads:

http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html

Your usage could cause all sorts of hard-to-diagnose problems, unless I misread what you're doing.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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 arch...@mail-archive.com

Reply via email to