Make @memoize thread-aware
Make @memoize thread-aware

If 2 parallel threads simultaneously make an expensive call to a
memoized function with arguments for which the returned value wasn's
cached before, 2 calls are effectively made in parallel.

It's better to avoid such a situation and if one thread already
initiated an expensive call, block on it in another thread and once
the call in the first thread is completed, unblock and reuse the value
which is cached now.

Co-Authored-By: Vladislav Kuzmin <fb505b8c9adb49de0f98ad8af81fb52ad9b37c76@mirantis.com>
Change-Id: Id216e7b9c1bd836ee70a36ecb378e7d51d3821d2

noironetworks/horizon,openstack/horizon,ChameleonCloud/horizon,NeCTAR-RC/horizon,BiznetGIO/horizon,noironetworks/horizon,BiznetGIO/horizon,yeming233/horizon,NeCTAR-RC/horizon,noironetworks/horizon,yeming233/horizon,openstack/horizon,BiznetGIO/horizon,NeCTAR-RC/horizon,BiznetGIO/horizon,noironetworks/horizon,openstack/horizon,ChameleonCloud/horizon,ChameleonCloud/horizon,yeming233/horizon,openstack/horizon,NeCTAR-RC/horizon,ChameleonCloud/horizon,yeming233/horizon