> On Aug 14, 2015, at 5:46 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> 
> wrote:
> 
> 
>> On Aug 14, 2015, at 4:15 PM, Ken Thomases <k...@codeweavers.com> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to