Ticket #8931: external_locking.qbk.patch

File external_locking.qbk.patch, 1.1 KB (added by the.malkolm@…, 9 years ago)
  • libs/thread/doc/external_locking.qbk

     
    217217* You can create a `strict_lock<T>` only starting from a valid T object. Notice that there is no other way you can create a `strict_lock<T>`.
    218218
    219219    BankAccount myAccount("John Doe", "123-45-6789");
    220     strict_locerk<BankAccount> myLock(myAccount); // ok
     220    strict_lock<BankAccount> myLock(myAccount); // ok
    221221
    222222* You cannot copy `strict_lock`s to one another. In particular, you cannot pass `strict_lock`s by value to functions or have them returned by functions:
    223223
     
    468468We need a way to transfer the ownership from the `unique_lock` to a `strict_lock` the time we are working with `savingsAcct_` and then restore the ownership on `unique_lock`.
    469469
    470470  void AccountManager::AMoreComplicatedChecking2Savings(int amount) {
    471       unique_lock<AccountManager> guard(*this, defer_lock);
     471      unique_lock<AccountManager> guard1(*this, defer_lock);
    472472      if (some_condition()) {
    473473          guard1.lock();
    474474      }