[wpilibc] Add mechanism to reset MotorSafety list (#4037)

This commit is contained in:
Dustin Spicuzza
2022-02-19 23:38:30 -05:00
committed by GitHub
parent 49adac9564
commit b2a8d3f0f3

View File

@@ -17,6 +17,15 @@ using namespace frc;
static wpi::SmallPtrSet<MotorSafety*, 32> instanceList;
static wpi::mutex listMutex;
#ifndef __FRC_ROBORIO__
namespace frc::impl {
void ResetMotorSafety() {
std::scoped_lock lock(listMutex);
instanceList.clear();
}
} // namespace frc::impl
#endif
MotorSafety::MotorSafety() {
std::scoped_lock lock(listMutex);
instanceList.insert(this);