|
Re: RoboRio Losing WPILib Preferences
Good Call.
We are currently using Preferences::GetInstance().Gettype("key", default) in the constructor of static instances of Subsystems.
We confirmed with printf that the values being returned are the defaults.
Looking at the source for Preferences we found a potential race condition such that the .Gettype() call gets the lock on m_tableLock before the ReadTask is fully spun up. If this occurs then the values are retrieved prior to being loaded from the file.
One solution would be serializing this process and not forking another thread/task to read the file.
The other solution would be to use the Contains("[i]key[I/]") and Wait() as you proposed in a loop.
Thanks Again!
Kyle
__________________
"May the coms be with you"
Is this a "programming error" or a "programmer error"?
|