There is a chance that all actions have completed before we hit the `Wait` call, we need to make sure we don't hit a deadlock.
This can happen if for instance there is only one action, and it is a "dummy" action, such as the one used in the EUA check.
Also I have removed the compound assignment for the `volatile _completedActionsCount` since Visual Studio was flagging it as a "suspicious usage of a volatile variable". I personally don't think it's a problem but better safe than sorry.
Contains minor whitespace fixes, too
Signed-off-by: Danilo Del Busso <danilo.delbusso@cloud.com>
- Immediately complete the ParallelAction when there are no subactions to be executed, to avoid on infinite lock while waiting for the actions to be completed.
Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
- Fixed the way we calculate PercentComplete for ParallelAction: use the sum of actions in actionsByConnection and actionsWithNoConnection instead of subActions.Count, to avoid waiting for the completion of actions that we never start, because we exclude actions with disconnected connections from actionsByConnections
- The multiple action is cancellable if is at least one sub action is not completed
- When a multiple action is cancelled, we try to cancel all sub actions that are not completed
- Also changed the way we calculate the percent complete for the parent action, to report partial progress of the sub actions
Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
* CA-77990: Report required actions for all VMs at once in the hotfix wizard / RPUW
* CA-77990: Resolve precheck problems in parallel in the Patching wizard
Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
* CA-77990: Resolve precheck problems in parallel in the Patching wizard
Changes following code review: Made the ParallelAction work across connections and removed CrossConnectionParallelAction
Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
* CA-77990: Modified ParallelAction to create queue on RunSubActions only, with the correct queue size
Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
NewAction to use the Action<ActionBase> delegate instead of EventHandler. Thus
there is no need to fire them with Empty or null EventArgs and on several occasions
we avoid casting objects in the event handlers.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>