Any way to make block from CFRunLoopPerformBlock run?

I have some NSViews that come and go during printing, and I want them to dealloc soon rather than waiting until the whole printing process is finished. The problem is that inside -[NSView addSubview:], the subview gets retained several times, and one of those schedules a release using CFRunLoopPerformBlock. But I don't have a run loop running, so that's not happening. The documentation of CFRunLoopPerformBlock says

If you want the work performed right away, you must explicitly wake up that thread using the CFRunLoopWakeUp function.

But calling CFRunLoopWakeUp( CFRunLoopGetMain() ) does not help, probably because the run loop is not running. If I call -[NSApplication nextEventMatchingMask: ...] in one of the standard modes, then the block from CFRunLoopPerformBlock runs, but too much other stuff also runs, such as queued notifications.

CFRunLoopPerformBlock lets you supply a run loop mode in which to run the block. If you specify a custom mode, you can run the run loop in that mode and it’ll only run your blocks.

If you’re unfamiliar with run loop modes, check out WWDC 2010 Session 207 Run Loops Section

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Any way to make block from CFRunLoopPerformBlock run?
 
 
Q