Re: Operations Beachball
Re: Operations Beachball
- Subject: Re: Operations Beachball
- From: Jens Alfke <email@hidden>
- Date: Tue, 04 Dec 2012 10:29:50 -0800
On Dec 4, 2012, at 3:48 AM, Gerriet M. Denkmann <email@hidden> wrote:
> My app creates lots of MyOperations (subclass of NSOperation) and puts them into an NSOperationQueue.
> I would expect that the app thus remains responsive, but sometimes it is not.
Welcome to the joys of multithreaded programming. :-P You have to be pretty careful about how you do things, or all sorts of unintuitive and flaky behaviors can result.
> + 1343 MenuBarInstance::Show(MenuBarAnimationStyle, unsigned char, unsigned char, unsigned char) (in HIToolbox) + 625 [0x7fff90ea5063]
> + 1343 BroadcastToolboxMessage (in HIToolbox) + 294 [0x7fff90e6e12a]
> + 1343 HIS_XPC_CFNotificationCenterPostNotification (in HIServices) + 532 [0x7fff8e57f174]
> + 1343 CFNotificationCenterPostNotification (in CoreFoundation) + 115 [0x7fff95edbbf3]
> + 1343 _CFXNotificationPost (in CoreFoundation) + 1109 [0x7fff95ecced5]
> + 1343 -[_NSDNXPCConnection sendMessage:waitForAck:] (in CoreFoundation) + 347 [0x7fff95fec12b]
> + 1343 _dispatch_semaphore_wait_slow (in libdispatch.dylib) + 241 [0x7fff97ed0486]
> + 1343 semaphore_wait_trap (in libsystem_kernel.dylib) + 10 [0x7fff95ac86c2]
>
>
> I have no idea, what this means.
> Maybe someone can enlighten me.
The main thread is sending a cross-process (XPC) message and waiting for a reply. Presumably this has something to do with arbitration of the menu bar state since the menu bar is a shared resource between apps? But it doesn’t seem related to anything you’re doing.
You didn’t post the rest of the sample output. My guess is that some other thread is running code that, for some reason, is holding whatever lock XPC needs. Are you calling AppKit from your background operations? (That’s almost certainly a bad idea!)
From this comment it sounds like the answer is yes:
> // sometimes do some logging, update user interface - but only every few seconds
DO NOT do anything UI-related from a background thread unless you _really_ know what you’re doing, or you can find yourself in exactly this sort of trouble.
—Jens
_______________________________________________
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