Summary:
`condition_variable::wait_for` takes as second param `std::chrono::duration`
and not a predicate; what we want is `condition_variable::wait`.
Reviewed By: simpkins
Differential Revision:
D4295305
fbshipit-source-id:
05f735fe6e7ecb9d8f42cb38a2985b9ce9dad984
When using `Synchronized` with a shared mutex type, it provides separate
`withWLock()` and `withRLock()` methods instead of `withLock()`.
When using `Synchronized` with a shared mutex type, it provides separate
`withWLock()` and `withRLock()` methods instead of `withLock()`.
-#### `ulock()` and `withULockPtr()`
+#### `ulock()` and `withULockPtr()`
`Synchronized` also supports upgrading and downgrading mutex lock levels as
long as the mutex type used to instantiate the `Synchronized` type has the
`Synchronized` also supports upgrading and downgrading mutex lock levels as
long as the mutex type used to instantiate the `Synchronized` type has the
// Assuming some other thread will put data on vec and signal
// emptySignal, we can then wait on it as follows:
auto locked = vec.lock();
// Assuming some other thread will put data on vec and signal
// emptySignal, we can then wait on it as follows:
auto locked = vec.lock();
- emptySignal.wait_for(locked.getUniqueLock(),
- [&] { return !locked->empty(); });
+ emptySignal.wait(locked.getUniqueLock(),
+ [&] { return !locked->empty(); });
```
### `acquireLocked()`
```
### `acquireLocked()`
An `acquireLockedPair()` function is also available, which returns a
`std::pair` instead of a `std::tuple`. This is more convenient to use
in many situations, until compiler support for structured bindings is
An `acquireLockedPair()` function is also available, which returns a
`std::pair` instead of a `std::tuple`. This is more convenient to use
in many situations, until compiler support for structured bindings is
### Synchronizing several data items with one mutex
### Synchronizing several data items with one mutex