• 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
Are NSWindowDidResizeNotifications permitted to arrive on the heartbeat thread?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Are NSWindowDidResizeNotifications permitted to arrive on the heartbeat thread?


  • Subject: Are NSWindowDidResizeNotifications permitted to arrive on the heartbeat thread?
  • From: Tim Gogolin <email@hidden>
  • Date: Tue, 16 Aug 2005 15:52:25 -0500

Does AppKit send UI notifications on non-main threads? Most of what I understand about AppKit lore says to do all UI tasks on the main thread only.

I wanted to listen to NSWindowDidResizeNotification notifications on a specific window and (through a bug on my part) wound up listening to ALL NSWindow resizes (I accidently passed 'nil' for the 'object' parameter). I was very surprised to get a NSNotification selector called on the UI heartbeat thread. I've fixed my code to only listen to the window I care about and life is good again (the notifications seem to be coming on the main thread now), but I'm still very curious... does listening to NSWindowDidResizeNotification for all NSWindows (by passing 'nil' for the 'object' param) intentionally result in getting some of those notifications while executing on the heartbeat thread? Seems like kind of shaky behavior on AppKit's part.

// pseudo code
- (void) setPanel: (int) whichPanel contentView: (AgValuePtr) contentValue
{
NSWindow* aWindow = [ foo getSpecialWindow ]; // my bug resulted in this being nil!


    [ [ NSNotificationCenter defaultCenter]
                addObserver: self
                selector: @selector(specialWindowDidResize:)
                name: NSWindowDidResizeNotification
                object: aWindow ];
}

-(void) specialWindowDidResize: (NSNotification*) n
{
     // Code that was unhappy when executing on a non-main thread
}


Is this a bug in AppKit, or is this permitted behavior?
(I could probably change my code back and get a stack trace showing the problem if that would help diagnose it)


--
Tim Gogolin
Adobe Systems
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Are NSWindowDidResizeNotifications permitted to arrive on the heartbeat thread?
      • From: Milton Sagen <email@hidden>
  • Prev by Date: Re: core data during startup (solved)
  • Next by Date: Re: Resizing an image and representing it in JPEG form
  • Previous by thread: Re: core data during startup (solved)
  • Next by thread: Re: Are NSWindowDidResizeNotifications permitted to arrive on the heartbeat thread?
  • Index(es):
    • Date
    • Thread