17 Jun
2022
17 Jun
'22
6:23 p.m.
Dear Experts, boost::upgrade_mutex m; void f() { boost::upgrade_lock l(m); // read shared state g(); } void g() { // precondition: upgrade lock held. boost::upgrade_to_unique_lock l(m); // write shared state } But that's not how it works. The upgrade_to_unique_lock takes the upgrade_lock as its ctor parameter, not the mutex. Is there a good reason for that? I think all that upgrade_to_unique_lock needs to do is to call m.unlock_upgrade_and_lock() in its ctor and m.unlock_and_lock_upgrade() in its dotr, i.e. it doesn't need to access any state in the upgrade_lock. Am I missing something? Regards, Phil.