Talk:cpp/thread/unique lock

void slow_log(bank_account &from, bank_account &to, int amount);

in void transfer(bank_account &from, bank_account &to, int amount) {   // ...    int from_copy = from.balance; int to_copy = to.balance; // ...   slow_log(from_copy, to_copy, amount); }

Types in call to slow_log do not match declaration.


 * Fixed. --198.228.201.150 18:40, 20 July 2012 (PDT)

Mutex and mutex_type

The template parameter "Mutex" is/was too similar to the type "mutex". It seems that "mutex_type" might have been intended anyway. The corresponding Template Parameter section was updated.

HOWEVER, the Member Types section seems a little nonsensical. Is this saying that the type is maintained as a member of the unique_lock? If so, what should be under the column heading "Definition"? A repeat of the text that goes with the template parameter? Arbalest (talk) 17:15, 11 March 2014 (PDT)


 * The class unique_lock exposes a type (via a public typedef) named "mutex_type", which is defined to be the same as the template argument type. I don't think it's going to work to have that template argument named "mutex_type" as well -- it'll make things way more confusing than before. I suspect the reason that we went with "Mutex" as the template argument is because that's how the standard does it. Do you have any ideas for something that works better than "Mutex"? --Nate (talk) 17:33, 11 March 2014 (PDT)


 * Oh, I didn't realize that mutex_type on the constructor page came from the member of that name. Arbalest (talk) 09:45, 12 March 2014 (PDT)


 * BasicLockable could work, except that it would make the text confusing where it talks about what unique_lock does when its template parameter is Lockable or TimedLockable. It could be just T (note that there are several more mentions of Mutex that weren't changed --Cubbi (talk) 18:06, 11 March 2014 (PDT)

Consider output?
Will it be better if output is added in the example? --LittleFlower (talk) 02:12, 22 January 2018 (PST)

try_lock desc inc?
The quick description of try_lock is "tries to lock (i.e., takes ownership of) the associated mutex, returns if the mutex is not available" but that sounds like the opposite of "true if the ownership of the mutex has been acquired successfully, false otherwise." which is what its page says. I haven't figured out where that bad text actually is to be edited. BenFrantzDale (talk) 09:00, 11 March 2021 (PST)
 * updated to the first line of try_lock's page. --Cubbi (talk) 10:19, 11 March 2021 (PST)