I have a list of images that I want to process in parallel, but with a timeout. My old code did this by swapping elements and using WaitHandles, but I want to use the new Parallel Linq or Tasks library, available in .Net 4.
The following snippet works, how can I add a timeout to it? (A timeout will be performed for each task, not a timeout for all processed items)
private PictureList FetchPictures(List<Picture> wallResults) { wallResults .AsParallel() .WithDegreeOfParallelism(10) .ForAll(delegate(Picture p){
source share