Acquire locks for multiple Synchronized<T> objects, in a deadlock-safe manner.
Declared in <folly/Synchronized.h>
template<
class Sync1,
class Sync2>
std::tuple</* implementation-defined */, /* implementation-defined */>
acquireLocked(
Sync1& l1,
Sync2& l2);
The locks are acquired in order from lowest address to highest address. (Note that this is not necessarily the same algorithm used by std::lock().) For parameters that are const and support shared locks, a read lock is acquired. Otherwise an exclusive lock is acquired.
use lock() with folly::wlock(), folly::rlock() and folly::ulock() for arbitrary locking without causing a deadlock (as much as possible), with the same effects as std::lock()
A tuple of locked pointers, one per object.
| Name | Description |
|---|---|
| l1 | The first object to lock. |
| l2 | The second object to lock. |