views:

44

answers:

1

I want to write an application that needs a Tasks queue. I should be able to add Tasks into this queue and these tasks can finish asynchronously (and should be removable from this queue, once they are complete)

The datastructure should also make it possible to get the information about any task within the Queue, provided a unique queue-position-identifier.

The data-structure should also provide the list of items in the queue anytime.

A LINQ interface to manage this queue will also be desirable.

Since this is a very common requirement for many applications (atleast in my personal observation), I want to know if there are any standard datastructures that are available as part of the c# library, instead of I writing something from the scratch.

Any pointers ?

A: 

Seems to me you are conflating the data structure and the asynch task that it is designed to track. Are you sure they need to be the same thing?

Does ThreadPool.QueueUserWorkItem not satisfy for running asynch tasks? You can maintain your own structure derived from List<TaskStatus> or HashSet<TaskStatus> to keep track of the results, and you can provide convenience methods to clear completed items, retrieve pending items, and so on.

Cheeso
ThreadPool is enough for me to Queue items. As you rightly mentioned in the second art of your comment, I can write my own class with these convenience methods. But wanted to know if the c# library already has some classes offering this functionality..
Sankar P