Fix ConcurrentModificationException in CommandScheduler (#1938)

This commit is contained in:
Oblarg
2019-10-18 10:56:12 -04:00
committed by Peter Johnson
parent bb0b207d2f
commit f4eedf597f
5 changed files with 78 additions and 0 deletions

View File

@@ -360,6 +360,13 @@ class CommandScheduler final : public frc::Sendable,
wpi::SmallVector<Action, 4> m_interruptActions;
wpi::SmallVector<Action, 4> m_finishActions;
// Flag and queues for avoiding concurrent modification if commands are
// scheduled/canceled during run
bool m_inRunLoop = false;
wpi::DenseMap<Command*, bool> m_toSchedule;
wpi::SmallVector<Command*, 4> m_toCancel;
friend class CommandTestBase;
};
} // namespace frc2