polling in the run loop
polling in the run loop
- Subject: polling in the run loop
- From: "stephen joseph butler" <email@hidden>
- Date: Sun, 20 Aug 2006 09:29:34 -0500
I'm writing a framework around a C library and I have a function that
provides data. I'd like to poll this function and then use the
delegate model to deliver the data. Is it a wise idea to poll each
time through the run loop? For example, my code looks like this:
- (void) startPoll {
[[NSRunLoop currentRunLoop]
performSelector:@selector(poll:)
target:self
argument:nil
order:0
modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
}
- (void) poll:(id)anObject {
possible_data = c_library_function();
if (possible_data) {
// provide data to the delegate
}
[[NSRunLoop currentRunLoop]
performSelector:@selector(poll:)
target:self
argument:nil
order:0
modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden