lockstep_scheduler: add generic lockstep component API

allows components to register and ensure the lockstep cycle waits for
all components to be updated.
This commit is contained in:
Beat Küng
2020-06-23 11:53:55 -04:00
committed by Daniel Agar
parent 55d06241b3
commit 5378d1468f
7 changed files with 313 additions and 2 deletions
@@ -583,4 +583,24 @@ int px4_pthread_cond_timedwait(pthread_cond_t *cond,
const uint64_t scheduled = time_us + px4_timestart_monotonic;
return lockstep_scheduler->cond_timedwait(cond, mutex, scheduled);
}
int px4_lockstep_register_component()
{
return lockstep_scheduler->components().register_component();
}
void px4_lockstep_unregister_component(int component)
{
lockstep_scheduler->components().unregister_component(component);
}
void px4_lockstep_progress(int component)
{
lockstep_scheduler->components().lockstep_progress(component);
}
void px4_lockstep_wait_for_components()
{
lockstep_scheduler->components().wait_for_components();
}
#endif