simgear/props/props.*: added locking using read/write mutex.

Added a std::shared_mutex to SGPropertyNode and changed all props code to use
shared or exclusive locks as necessary whenever reading/writing data.

SG_PROPERTY_LOCKING=0 or 1 can be used to control whether locking is
active. Default is 1.

SG_PROPERTY_LOCKING_VERBOSE=0 or 1 can be used to cause diagnostics to be
generated if we get lock contention. Default is 0.

Removed most of the inline implementation code in props.hxx - now that we use
locking, nearly all calls eventually end up in props.cxx in order to take out
a lock so there's no point inlining. For template code this also means that we
now explicitly instantiate / specialise in props.cxx.

Reformateed props.hxx to use consistent indentation. Also condensed identical
comments for related methods such as getBoolValue(), getIntValue() etc, which
results in more readable visual grouping.

Much of the internal implementation code for SGPropertyNode is now in the form
of static methods in a new SGPropertyNodeImpl class in props.cxx. This class is
marked as a friend of SGPropertyNode in props.hxx so these methods can access
all SGPropertyNode internal data without being declared in props.hxx. So one
can change implementation code without recompiling everything.

Removed TEST_READ and TEST_WRITE macros.

Removed SGPropertyNode::MAX_STRING_LEN - was only used in compare_strings() and
it is unnecessary.
This commit is contained in:
Julian Smith 2021-01-21 12:53:34 +00:00
parent 64e4adf0b9
commit f1dd7901cb
2 changed files with 3330 additions and 2624 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff