Recurrent NSInvocationOperations on an NSOperationQueue?
Recurrent NSInvocationOperations on an NSOperationQueue?
- Subject: Recurrent NSInvocationOperations on an NSOperationQueue?
- From: Carl Hoefs <email@hidden>
- Date: Fri, 14 Aug 2015 15:23:57 -0700
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:
- maxConcurrentOperationCount = 1
- qualityOfService = NSOperationQualityOfServiceBackground
I enqueue a resource-accessing status-sensing NSInvocationOperation onto the queue.
- If it detects good status, it re-queues itself to the queue *after 60 seconds*. In the meantime, the queue should be empty for user jobs that may wish to access the resource.
- If it detects bad status, it performs whatever actions necessary (may take many minutes). When done, it re-queues itself to the queue *after 60 seconds*.
I've tried -performSelector:withObject:afterDelay: within the NSInvocationOperation but it does nothing. If I directly re-queue the NSInvocationOperation, of course it runs again immediately. Is there a way to do this?
-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