Update the LoanManager to do internal locking. (#552)
Update the LoanManager to do internal locking. (#552)

The original motivation to do this is to please the clang
thread safety analysis, which can't quite figure out the
locking regime with an external mutex.  Instead, move major
functionality into the LoanManager class, and then mark
the item list as private.

One thing to note is that the logic of
__rmw_take_loaned_message_internal is slightly changed here.
Before it would emplace an Item onto the LoanManager's list,
then look through the data_reader to see if it could take an
item.  If it could, it would just fill that Item in and return.
If it couldn't, it would pop that item out of the list.  This
commit changes it so that we instantiate a temporary Item.
If we can take an item, we then push that Item into the LoanManager
list.  We never pop it.  This should be equivalent (and
slightly more performant), but is a change from what we had
before.

Signed-off-by: Chris Lalancette <281cd07d7578d97c83271fbbf2faddb83ab3791c@openrobotics.org>
ros2/rmw_fastrtps,ros2/rmw_fastrtps,eProsima/ROS-RMW-Fast-RTPS-cpp