From b2a8d3f0f35790e004635df129f8aa75ad9b7cde Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Sat, 19 Feb 2022 23:38:30 -0500 Subject: [PATCH] [wpilibc] Add mechanism to reset MotorSafety list (#4037) --- wpilibc/src/main/native/cpp/MotorSafety.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wpilibc/src/main/native/cpp/MotorSafety.cpp b/wpilibc/src/main/native/cpp/MotorSafety.cpp index 9cb28cd1f5..91b4dfb328 100644 --- a/wpilibc/src/main/native/cpp/MotorSafety.cpp +++ b/wpilibc/src/main/native/cpp/MotorSafety.cpp @@ -17,6 +17,15 @@ using namespace frc; static wpi::SmallPtrSet 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);