[interprocess] Assign to shared_lock from scoped_lock

If I have (template args removed for brevity): shared_lock sh_lock(mutex); scoped_lock sc_lock(move(sh_lock), try_to_lock); // Try for exclusive if (sc_lock) { ... sh_lock = move(sc_lock); // Drop back to shared *** not available } Should that assignment operator be available? Currently I'm working around this with: sh_lock.swap(shared_lock(move(sc_lock))); [or, alternatively: sh_lock = move(shared_lock(move(sc_lock))); ]

Chard wrote:
If I have (template args removed for brevity):
shared_lock sh_lock(mutex);
scoped_lock sc_lock(move(sh_lock), try_to_lock); // Try for exclusive if (sc_lock) { ... sh_lock = move(sc_lock); // Drop back to shared *** not available }
Should that assignment operator be available?
All locks just implement move-assignment from it's own type. Exclusive -> sharable is guaranteed to succeed so it might be added. The same would happen with scoped->upgradable and upgradable->sharable. I'll add it to my to do list. Best, Ion
participants (2)
-
Chard
-
Ion Gaztañaga