Nested WAIT or Sequential WAIT?
Spire_Jeff
Posts: 1,917
I am wondering if there is any benefit to nesting waits? Here is a little example:
versus:
Would the first one require less processor overhead as in my mind, the processor is only tracking 1 wait through the whole process?
Jeff
button_event[dvtp,1]{ push:{ do_thing(1); wait 5 {do_thing(2); wait 5 {do_thing(3); wait 5 {do_thing(4); }}} } }
versus:
button_event[dvtp,1]{ push:{ do_thing(1); wait 5 do_thing(2); wait 10 do_thing(3); wait 15 do_thing(4); } }
Would the first one require less processor overhead as in my mind, the processor is only tracking 1 wait through the whole process?
Jeff
0
Comments
The only benefit I can see for not nesting would be if you needed the ability to cancel one wait with out affected the others. If they're nested cacelling one wait would cancel any waits nested beneath it which aren't actually "waiting" yet. They're waiting to wait.
That is a good point. The only thing is the canceling of nested waits.... I don't think you would be able to cancel a nested wait unless it is actually waiting at the time of cancel. If it is waiting when you cancel it, it would cancel all remaining waits. This raises an interesting thought.... what if you named all of the waits the same name? You should be able to cancel the named wait and it would cancel any wait that has not executed.
Jeff
Jeff