Your Digital Media Has Never Looked So Good

Topic Author
Posts: 26
Joined: Thu Sep 14, 2017 9:09 am

Two WHILE loops in the main code?

Fri Oct 06, 2017 8:20 am

I currently have two WHILE loops in the main code listening to the port in case particular  events that happen in the components. However, one of the loops is never reached since the 1st while loop loops indefinitely. I could achieve what I want by combining both  WHILE loops into a single WHILE loop, but for business logic reasons that are too long and off the subject, I am not able to.

Therefore is there anyway to run 2 WHILE loops at the same time? Is there a workaround? 

If I could create a timer using code, then I could delay by a few milliseconds starting one of the WHILE loops and theoretically I could get both  running at the same time. But as far as I know creating a timer cannot be done programatically; it has to be done using XML which the main code doesn't have access to. 

How do I get 2 WHILE loops running at the same time from within the main part of the code?
Posts: 40
Joined: Wed Feb 04, 2015 5:17 pm

Re: Two WHILE loops in the main code?

Fri Oct 13, 2017 3:38 pm

As far as I know, it's not possible to run multiple while loops at the same time. There are ways to create timing functionality without using the SceneGraph (XML) timer component (try roTimespan). But I would encourage you to figure out a way to make all the business logic fit into one while loop.
User avatar
Posts: 792
Joined: Sun Apr 21, 2013 2:20 pm

Re: Two WHILE loops in the main code?

Sat Oct 14, 2017 7:01 am

Make the secondary loop a function instead and put it in the primary loop?
Kinetics Screensavers

Who is online

Users browsing this forum: No registered users and 1 guest