mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 23:53:33 +08:00
Preventing recursive calls of Scheduler::spin()
This commit is contained in:
@@ -154,6 +154,13 @@ void Scheduler::pollCleanup(MonotonicTime mono_ts, uint32_t num_frames_processed
|
||||
|
||||
int Scheduler::spin(MonotonicTime deadline)
|
||||
{
|
||||
if (inside_spin_) // Preventing recursive calls
|
||||
{
|
||||
assert(0);
|
||||
return -1;
|
||||
}
|
||||
inside_spin_ = true;
|
||||
|
||||
int retval = 0;
|
||||
while (true)
|
||||
{
|
||||
@@ -171,6 +178,8 @@ int Scheduler::spin(MonotonicTime deadline)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inside_spin_ = false;
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user