Debugging AIStatefulTask (3)

STATEFULTASK: Running state bs_multiplex / MonteCarlo_alpha [0x18e0280] NOTICE : randomnumber = 18 STATEFULTASK: Entering AIStatefulTask::idle() [0x18e0280] STATEFULTASK: No need to run [0x18e0280] STATEFULTASK: Erasing stateful task [0x18e0280] from gMainThreadEngine STATEFULTASK: Sorting 0 stateful tasks. NOTICE : Looped 20 times, calling cont(). STATEFULTASK: Entering AIStatefulTask::cont() [0x18e0280] STATEFULTASK: Entering AIStatefulTask::multiplex(schedule_run) [0x18e0280] STATEFULTASK: Entering AIStatefulTask::begin_loop(bs_multiplex) [0x18e0280] STATEFULTASK: Need to run, will run right now [0x18e0280] STATEFULTASK: Entering AIStatefulTask::begin_loop(bs_multiplex) [0x18e0280] STATEFULTASK: Running state bs_multiplex / MonteCarlo_alpha [0x18e0280] NOTICE : randomnumber = 36 STATEFULTASK: Entering AIStatefulTask::set_state(MonteCarlo_alpha) [0x18e0280] STATEFULTASK: Entering AIStatefulTask::yield(gMainThreadEngine) [0x18e0280] STATEFULTASK: Need to run, adding to engine [0x18e0280] STATEFULTASK: Adding stateful task [0x18e0280] to gMainThreadEngine STATEFULTASK: Entering AIStatefulTask::multiplex(normal_run) [0x18e0280] STATEFULTASK: Entering AIStatefulTask::begin_loop(bs_multiplex) [0x18e0280] STATEFULTASK: Insertion of advance_state(MonteCarlo_beta) at AIStatefulTask.cxx:0 STATEFULTASK: | Entering AIStatefulTask::advance_state(MonteCarlo_beta) [0x18e0280] STATEFULTASK: Running state bs_multiplex / MonteCarlo_alpha [0x18e0280] NOTICE : randomnumber = 40 STATEFULTASK: Entering AIStatefulTask::set_state(MonteCarlo_beta) [0x18e0280] STATEFULTASK: Entering AIStatefulTask::idle() [0x18e0280] STATEFULTASK: Need to run, will run right now [0x18e0280] STATEFULTASK: Entering AIStatefulTask::begin_loop(bs_multiplex) [0x18e0280] STATEFULTASK: Running state bs_multiplex / MonteCarlo_beta [0x18e0280] COREDUMP : /home/carlo/projects/feniks/montecarlo/montecarlo/statefultask/AIStatefulTask.cxx:426: void AIStatefulTask::multiplex(AIStatefulTask::event_type, AIEngine*): Assertion `mDebugShouldRun' failed.
Slightly improved debug output.

Apparently, MonteCarlo_alpha runs and calls idle().
After a while the mainloop calls cont(), so we run MonteCarlo_alpha again.
This time it calls set_state(MonteCarlo_alpha) and yield(), which causes
multiplex to be reentered - at this point a call to advance_state(MonteCarlo_beta)
is inserted.
State MonteCarlo_alpha continous to run first though and calls this time
set_state(MonteCarlo_beta) followed by idle().

Next the statemachine decide it needs to run because advance_state()
was called before the idle()... but this is indeed wrong: a call to advance_state()
should only void the next call to idle() if it happens after the last set_state,
and a new call to set_state() happened since, so the advance_state should
not have any effect.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.