On Wed, Mar 26, 2014, at 02:33 PM, Jens Alfke wrote: > I’d like to be able to detect this situation and log a warning or throw > an exception. But I can’t figure out what to check. I know that > [NSRunLoop currentRunLoop] will create a new runloop for the current > thread if one doesn’t exist, so it never returns nil. Will looking at its > -currentMode help? Or should I bridge over to CFRunLoop and check whether > there are any attached sources?
This smells like a really bad design. The concept of an "active" runloop doesn't actually map to anything that accurately describes the system. Some code might use -runMode:beforeDate: to process a single event at a time. That code might be invoked by code that's running a runloop via -run. And the runloop might _never_ run in the mode in which you post your -performSelector:afterDelay:. If you want to delay something for later, you should probably use dispatch_after. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list ([email protected]) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
