Fix Synchronized.md documentation to use correct condition_variable::wait call
authorDavid Lam <davidlam@fb.com>
Wed, 7 Dec 2016 23:32:30 +0000 (15:32 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Wed, 7 Dec 2016 23:38:25 +0000 (15:38 -0800)
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

folly/docs/Synchronized.md

index e65015a27c98affd4e7e0ff1143983e0ee6db8cc..3d4bff0c1070aba096950464684c9456ec34d686 100644 (file)
@@ -366,7 +366,7 @@ This code does not have the same problem as the counter-example with
 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
@@ -669,8 +669,8 @@ The `LockedPtr` returned by `Synchronized<T, std::mutex>::lock()` has a
     // 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()`
@@ -728,7 +728,7 @@ which will make the returned tuple more convenient to use:
 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
-more widely available. 
+more widely available.
 
 ### Synchronizing several data items with one mutex
 
 
 ### Synchronizing several data items with one mutex