I would like to consider using Task with TPL .
var task1 = Task.Run(() => instance.dummyMethod) .ContinueWith((completedTask) => Console.WriteLine("Each callback here. Result: " + completedTask.Result)); // Blocks calling thread until all tasks are done. Task.WaitAll(new [] { task1, task2 });
WaitAll all ensures that all WaitAll are executed before the main thread continues. The above allows you to implement individual callbacks.
Alternatively, use a single callback when All asynchronization methods are complete:
Task.Factory.ContinueWhenAll(new [] { task1, task2 }, (allTasks) => Console.WriteLine("Callback when all are done."));
source share