Concurrent Priority Queue in .NET 4.0

前端 未结 9 819
攒了一身酷
攒了一身酷 2020-12-09 02:32

It seems there are lots of improvements in .NET 4.0 related to concurrency that might rely on concurrent priority queues. Is there decent priority queue implementation insid

9条回答
  •  再見小時候
    2020-12-09 02:54

    You may need to roll your own. A relatively easy way would be to have an array of regular queues, with priority decreasing.

    Basically, you would insert into the queue for the appropriate priority. Then, on the consumer side, you would go down the list, from highest to lowest priority, checking to see if the queue is non-empty, and consuming an entry if so.

提交回复
热议问题