So you don't know the jobs ahead of time?

If there really is a phase transition from "jobs coming in" to "all jobs are in, now wait for all results" then collecting a global set of AsyncFuture objects and synchronizing on them sounds OK.

If jobs continue to come in then you may want to have the jobs send their results to a dedicated agent (MailboxProcessor) that collects and aggregates them and either processes requests for the aggreagate reults or fires events on the GUI thread (if there is one) as new results come in.

Regards

don

By on 7/5/2008 8:19 PM ()

Yes, the jobs depend on the input, so I don't know about them in advance.

Basically, I have a long running sequential computation which discovers sub-computations that can be run in parallel. I'd like to start working on the sub-computations as soon as I discover them to fully exploit any latent parallelism.

Thanks for the help,
Stephan

By on 7/6/2008 1:12 AM ()

Right - futures are perfect for this (use either the F# Async ones or the TPL ones)

don

By on 7/7/2008 5:20 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper