Re: Recurrent NSInvocationOperations on an NSOperationQueue?
Re: Recurrent NSInvocationOperations on an NSOperationQueue?
- Subject: Re: Recurrent NSInvocationOperations on an NSOperationQueue?
- From: Carl Hoefs <email@hidden>
- Date: Fri, 14 Aug 2015 18:07:38 -0700
> On Aug 14, 2015, at 5:46 PM, Carl Hoefs <email@hidden> wrote:
>
>
>> On Aug 14, 2015, at 4:15 PM, Ken Thomases <email@hidden> wrote:
>>
>> You'll need to create a new operation each time you want to queue a particular invocation.
>
> Yes, I'm doing that. The problem is finding a mechanism to re-queue a new operation from the current one after it is done, so the queue can be empty for a time.
Here's what I'm trying to do, but in code rather than words:
. . .
[self doStatusChecks]; // start endless checking at 1-min intervals
. . .
- (void)doStatusChecks
{
[jobQueue addOperation:[[NSInvocationOperation alloc] initWithTarget:self
selector:@selector(checkStatus) object:nil]];
}
- (void)checkStatus
{
// Access device & read status
// If bad, do work...
// Enqueue another operation, but after 60 sec delay
[self performSelector:@selector(doStatusChecks)
withObject:nil
afterDelay:60.0]; // <-- This never fires!
[self doStatusChecks]; // <-- Fires immediately, but not what I want
}
-Carl
_______________________________________________
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