How do I change the enddate for a runloop?
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.