• 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
How do I change the enddate for a runloop?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do I change the enddate for a runloop?


  • Subject: How do I change the enddate for a runloop?
  • From: Victor Ng <email@hidden>
  • Date: Tue, 11 Feb 2003 10:28:14 -0500

I'm having problems figuring out how to get a run-loop to run something
until a class gets to a 'termination' state and then I want the
run-loop to exit.

I'm just starting to use threads and run-loops explicitly so if I'm
using the wrong idiom to do this - someone just tell me.

I have a class that fetches web pages over HTTP. In my unit test I
have the following code:

VTNXMLRetriever* xmlFetch = [[VTNXMLRetriever alloc] init];

// execute the current runloop
[xmlFetch downloadURL:nil];

NSLog(@"start runloop");
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate
dateWithTimeIntervalSinceNow:10]];
NSLog(@"end runloop");


My XML retriever class has an internal timeout timer so the class will
either completely download a page, or else it will timeout and set the
object into an 'fail' state. My problem is that calling -runUntilDate:
on the current run-loop makes my retriever class block for too long if
a page comes back quickly.

Any ideas?

vic
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: How do I change the enddate for a runloop?
      • From: Scott Anguish <email@hidden>
  • Prev by Date: Large volume printing question
  • Next by Date: Re: AddressBook issues
  • Previous by thread: Large volume printing question
  • Next by thread: Re: How do I change the enddate for a runloop?
  • Index(es):
    • Date
    • Thread