View Single Post
  #3   Spotlight this post!  
Unread 02-07-2015, 09:51 AM
kylelanman's Avatar
kylelanman kylelanman is offline
Programming Mentor
AKA: Kyle
FRC #2481 (Roboteers)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Tremont Il
Posts: 185
kylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to all
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"?

Reply With Quote