1

I can use the methods split or newChild to create a child for a SubMonitor [1]:

SubMonitor firstChild = parentMonitor.split(50);
SubMonitor secondChild = parentMonitor.split(50);

The creation of the second child automatically finishes the first child [2]:

Each SubMonitor only has one active child at a time. Each time newChild(int) or split(int) is called, the result becomes the new active child and any unused progress from the previously-active child is consumed.

This makes it unnecessary to call done() on a SubMonitor instance, since child monitors are automatically cleaned up the next time the parent is touched.

=> What is the recommended way to create child monitors if I don't want to execute one child after another but run them concurrently?

Creating the second monitor child would immediately result in a wrong total progress, since the first child is not finished yet.

Some ideas:

a) Don't use SubMonitor at all for that concurrent case but stick to the deprecated SubProgressMontior (I did not check if that would help, yet.)?

b) Somehow skip the consumption of unused progress? (The suppressFlags that can be passed to the split method do not seem to provide a value for that.)

Related questions

Stefan
  • 10,010
  • 7
  • 61
  • 117
  • 1
    A progress monitor does not have any support for concurrent execution. That 'parallel jobs' answer looks like it is just running multiple Jobs (or UIJobs) and showing the progress in the Progress view – greg-449 Aug 16 '17 at 13:22
  • Thank you for clarification. So it seems I have to implement my own ConcurrentSubMonitor. – Stefan Aug 16 '17 at 13:36

0 Answers0