• 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: NSDistributedNotificationCenter questions.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDistributedNotificationCenter questions.


  • Subject: Re: NSDistributedNotificationCenter questions.
  • From: "Mr. Gecko" <email@hidden>
  • Date: Sat, 19 Feb 2011 09:04:59 -0600

Something like this?

static NSAutoreleasePool *pool = nil;

void runloop(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) {
	if (activity & kCFRunLoopEntry) {
		if (pool!=nil) [pool drain];
		pool = [NSAutoreleasePool new];
	} else if (activity & kCFRunLoopExit) {
		[pool drain];
		pool = nil;
	}
}

CFRunLoopObserverContext  context = {0, self, NULL, NULL, NULL};
CFRunLoopObserverRef observer = CFRunLoopObserverCreate(kCFAllocatorDefault, kCFRunLoopEntry | kCFRunLoopExit, YES, 0, runloop, &context);
CFRunLoopAddObserver(CFRunLoopGetCurrent(), observer, kCFRunLoopDefaultMode);

I know the way I'm doing it works, but I want to verify it's right.

On Feb 18, 2011, at 9:58 PM, Kyle Sluder wrote:

> Nest your own autorelease pool. You can use a runloop observer to make
> sure it gets drained regularly.
>
> There's a constant somewhere that says what priority AppKit's
> NSAutoreleasePool runloop observer uses, but I can't find it in the
> documentation right now. You can insert yourself above that priority
> to ensure that your runloop wraps AppKit's.
>
> --Kyle Sluder

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

_______________________________________________

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

References: 
 >NSDistributedNotificationCenter questions. (From: "Mr. Gecko" <email@hidden>)
 >Re: NSDistributedNotificationCenter questions. (From: Ken Thomases <email@hidden>)
 >Re: NSDistributedNotificationCenter questions. (From: "Mr. Gecko" <email@hidden>)
 >Re: NSDistributedNotificationCenter questions. (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: NSDistributedNotificationCenter questions.
  • Next by Date: NSTextAttachment, MouseOver, GlyphPosition
  • Previous by thread: Re: NSDistributedNotificationCenter questions.
  • Next by thread: iPhone double oddity
  • Index(es):
    • Date
    • Thread