> I'm handling some mouse dragging tasks modally by implementing my own modal 
> event loop using [NSApp nextEventMatchingMask:untilDate:inMode:dequeue:].
> 
> I'm wondering what is the usual correct thing to pass for the 'untilDate' 
> parameter. For a long time I've been using [NSDate distantFuture], but the 
> documentation of this method says that by passing nil it uses [NSDate 
> distantPast], which implies perhaps that this is a more usual default. In 
> thinking about this I realise I don't 

I am running manually a runloop in a command line utility that loads XML data 
through an URL. I use the current date for the time parameter like this:

while (_WMSenCours) {
                
        [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode
                                 beforeDate:[NSDate 
dateWithTimeIntervalSinceNow:0]];
}
 
where the flag _WMSenCours goes false when I received a message of data 
completion.

I suspect if you pass a date that is either in the past or present, the runloop 
is performed only once and exits whether it detects or no an incoming event. If 
you specify “distant future”, you will be stuck in the runloop until an event 
occurs. Which, in most cases, should not make any difference except for 
debugging purposes.

Vincent
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to