Jump to content
Sign in to follow this  
Tim Koscielski

With a Parllel.Pipeline, how can you update the UI in the main thread?

Recommended Posts

I am just getting familiar with using OmniThread and I have been trying to figure out how to get feedback from a Parallel.Pipeline to the main UI thread to update an activity indicator or progress bar. I understand how to use TOmniEventMonitor when using the CreateTask API call. But as I look at a Parallel.Pipeline command I can't see how to register a TOmniEventMonitor object to collect info from the threads that are part of the Pipeline.

 

What is the best option to get messages back to the UI to update progress for a Parallel.Pipeline task?

 

In looking at the FileScanner demo, the are doing something like this to create the task.

 

FFolderScanner := Parallel.Pipeline
    .NoThrottling
    .Stage(UniqueFilter_asy)
    .Stage(FolderScanner_asy)          
      .NumTasks(inpNumScanners.Value)
    .Stage(DataCollector_asy,          
      Parallel.TaskConfig.OnTerminated(WorkDone)
      )
    .Run;

How do I link in or use a TOmniEventMonitor that can work with each of the Stages of this Pipeline.

 

Thanks.

 

tim

Share this post


Link to post

OK, I think I found that I can use a TOmniMessageQueue as one option. If I create this with a handler for the OnMessage event, that seems to allow me to accomplish updating the Activity Indicator in the UI without adding much overhead to the Parallel.Pipeline process.

 

Is this a good option for the library or is there another method that perhaps works better?

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×