Separate the periodic() call in SwerveModule into an updateInputs() call and a now independent periodic() call, that way only the updateInputs() call needs to be behind a read/write lock, and the rest of the periodic logic can remain outside of the lock, as it is thread safe.
This reduces the chances of a deadlock occurring by mistake when writing code in the old periodic() method, and also reduces the amount of the time the read/write lock is held for.
Separate the
periodic()
call inSwerveModule
into anupdateInputs()
call and a now independentperiodic()
call, that way only theupdateInputs()
call needs to be behind a read/write lock, and the rest of the periodic logic can remain outside of the lock, as it is thread safe.This reduces the chances of a deadlock occurring by mistake when writing code in the old
periodic()
method, and also reduces the amount of the time the read/write lock is held for.