I have a list of Pictures that I want to process in parallel, but with a timeout. My old code did this by paging through the items and using WaitHandles, but I want to use the new Parallel Linq or Tasks library available in .Net 4.
The following snippet is working, how do I add a timeout to it? (Timeout would be for each task executing, not a timeout for all items to be processed)
private PictureList FetchPictures(List<Picture> wallResults)
{
wallResults
.AsParallel()
.WithDegreeOfParallelism(10)
.ForAll(delegate(Picture p){