Ensure the cachedproperty creation/setting is thread-safe

When the cachedproperty descriptor is attached to an object
that needs to be only created/set by one thread at a time we
should ensure that this is done safely by using a lock to
prevent multiple threads from creating and assigning the
associated attribute.

Fixes bug 1366156

Change-Id: I0545683f83402097f54c34a6b737904e6edd85b3
Merge "Ensure the cachedproperty creation/setting is thread-safe"