• 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: Event loop expiration date insight
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Event loop expiration date insight


  • Subject: Re: Event loop expiration date insight
  • From: Vincent Habchi <email@hidden>
  • Date: Wed, 31 Oct 2012 07:45:48 +0100

> 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 (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: 
 >Event loop expiration date insight (From: Graham Cox <email@hidden>)

  • Prev by Date: Event loop expiration date insight
  • Next by Date: Re: Event loop expiration date insight
  • Previous by thread: Event loop expiration date insight
  • Next by thread: Re: Event loop expiration date insight
  • Index(es):
    • Date
    • Thread