Threaded queues for processing of items in a thread