I have a problem I don't find how to solve. I have a main thread running two nested loops. The nested loop is executing business rules and checking a certain condition to know when it breaks.
The problem here is this condition is time expensive and the goal of main program is to measure the time it takes, so checking this condition again and again introduces a skewness into the time measure.
I think I could put the checker into an independent thread and when it is satisfied, notify to the main thread and get out from the nested loop. Is it possible?
Thanks