Re: Recurrent NSInvocationOperations on an NSOperationQueue?

2015-08-14 Thread Carl Hoefs
> On Aug 14, 2015, at 7:01 PM, Ken Thomases wrote: > > On Aug 14, 2015, at 8:43 PM, Carl Hoefs > wrote: > > You can use a serial GCD queue for the same purpose with my above > suggestions. But even if you want to keep using an NSOperationQueue, you can > still use my first dispatch_after()

Re: Recurrent NSInvocationOperations on an NSOperationQueue?

2015-08-14 Thread Roland King
>> > > Thanks, Ken. The reason I'm using a custom operation queue instead of GCD is > that I need to permit only exclusive access to the device (e.g., to obtain > its status requires writing to it), but allow other operations enqueued to > use the device, not just the status checks. So I have

Re: Recurrent NSInvocationOperations on an NSOperationQueue?

2015-08-14 Thread Ken Thomases
On Aug 14, 2015, at 8:43 PM, Carl Hoefs wrote: > On Aug 14, 2015, at 6:24 PM, Ken Thomases wrote: >> >> -performSelector:withObject:afterDelay: depends on the run loop. The >> threads that service any non-main NSOperationQueue don't run their run loop. >> In fact, you can't rely on them sur

Re: Recurrent NSInvocationOperations on an NSOperationQueue?

2015-08-14 Thread Carl Hoefs
> On Aug 14, 2015, at 6:24 PM, Ken Thomases wrote: > > On Aug 14, 2015, at 8:07 PM, Carl Hoefs > wrote: > >> Here's what I'm trying to do, but in code rather than words: >> >> . . . >> [self doStatusChecks]; // start endless checking at 1-min intervals >> . . . >> >> >> - (void)doSt

Re: Recurrent NSInvocationOperations on an NSOperationQueue?

2015-08-14 Thread Ken Thomases
On Aug 14, 2015, at 8:07 PM, Carl Hoefs wrote: > 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 a

Re: Recurrent NSInvocationOperations on an NSOperationQueue?

2015-08-14 Thread Carl Hoefs
> On Aug 14, 2015, at 5:46 PM, Carl Hoefs > wrote: > > >> On Aug 14, 2015, at 4:15 PM, Ken Thomases 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 > op

Re: Recurrent NSInvocationOperations on an NSOperationQueue?

2015-08-14 Thread Carl Hoefs
> On Aug 14, 2015, at 4:15 PM, Ken Thomases 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 em

Re: Recurrent NSInvocationOperations on an NSOperationQueue?

2015-08-14 Thread Ken Thomases
On Aug 14, 2015, at 5:23 PM, Carl Hoefs wrote: > I'm trying to automatically re-queue an NSInvocationOperation to an > NSOperationQueue every n seconds, but I can't get it to work. From the NSOperation class overview: "An operation object is a single-shot object—that is, it executes its task o

Recurrent NSInvocationOperations on an NSOperationQueue?

2015-08-14 Thread Carl Hoefs
I'm trying to automatically re-queue an NSInvocationOperation to an NSOperationQueue every n seconds, but I can't get it to work. For the purpose of serializing exclusive access to a specific resource, I have a single-threaded background NSOperationQueue with parameters: - maxConcurrentOperation