Ticket #8931: external_locking.qbk.patch
File external_locking.qbk.patch, 1.1 KB (added by , 9 years ago) |
---|
-
libs/thread/doc/external_locking.qbk
217 217 * 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>`. 218 218 219 219 BankAccount myAccount("John Doe", "123-45-6789"); 220 strict_loc erk<BankAccount> myLock(myAccount); // ok220 strict_lock<BankAccount> myLock(myAccount); // ok 221 221 222 222 * 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: 223 223 … … 468 468 We 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`. 469 469 470 470 void AccountManager::AMoreComplicatedChecking2Savings(int amount) { 471 unique_lock<AccountManager> guard (*this, defer_lock);471 unique_lock<AccountManager> guard1(*this, defer_lock); 472 472 if (some_condition()) { 473 473 guard1.lock(); 474 474 }