Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Terminate early during long operations like RouteAllArrows and FindAllPaths (Read 4762 times)
bt1
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Oct 18th, 2011
Terminate early during long operations like RouteAllArrows and FindAllPaths
Sep 17th, 2013 at 11:07am
Print Post  
Hi,

I am working with large interactive graphs and most operations like FindAllPaths, RouteAllArrows and ArrangeDiagram can take a long time to run (especially RouteAllArrows).

I do all graph operations in background threads so the rest of my GUI remains responsive and this is working nicely.

I need to be able to gracefully terminate background threads on demand. Calling kernel32!TerminateThread is not a solution as I need clean-up code and other things to execute when the thread is finishing up.

For all my non-graph background threads I can test if the current thread has been signalled to terminate and if so then stop the current operation early. I cant seem to do this with a FlowChartX control.

How do I signal long operations (FindAllPaths, RouteAllArrows and ArrangeDiagram) to finish early? is there a variable I can set to force a FlowChart component to finish its current operation early, or is there a callback I can use?

Thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Terminate early during long operations like RouteAllArrows and FindAllPaths
Reply #1 - Sep 17th, 2013 at 12:59pm
Print Post  
Hi,

RouteAllArrows just loops over all arrows and calls their Route method. So you could implement your own for-each loop that calls arrow.Route and breaks if some bool variable is set.

You could do something similar for ArrangeDiagram if using force-directed algorithms (spring, anneal, grid, circular layouts). E.g. run only a few iterations inside the loop, break if a variable is set, otherwise continue with more iterations.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
bt1
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Oct 18th, 2011
Re: Terminate early during long operations like RouteAllArrows and FindAllPaths
Reply #2 - Sep 17th, 2013 at 2:05pm
Print Post  
Thanks, implementing a simple RouteAllArrows method which checks for early termination is working perfectly.

I can get by without early termination for FindAllPaths and ArrangeDiagram for now, although perhaps this could be a feature in a future version.

Thank you very much for your help Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint