A question about NSOperationQueue:

Is there a way to add operations to the queue so that they "jump the queue" 
ahead of any operations that are not running and have not been run yet?

Here's my use case:

I have a browser that browses folders full of SVG files. To create a thumbnail 
preview of the file, it needs to be parsed and converted but it's really slow 
to do this, so I encapsulate this in an operation and stick it on a concurrent 
operation queue. The queue limits the number of concurrent ops to a small 
handful. As each thumbnail is generated, it refreshes the browser and the 
thumbnail pops into view.

If I'm scrolling through the browser, it may have queued up a large number of 
these, but ideally I would prefer if it gave priority to those that are 
actually visible in the window, which are the ones most recently added to the 
queue. Instead, it adds them to the end which means I often have to wait a long 
time for the window to show the thumbnails. Setting a higher priority on these 
items doesn't help because the operations all end up with the same priority.

An NSOperationQueue that simply iterated in reverse would do it, or a way to 
prepend the objects to the head of the queue.

--Graham

 
_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to