Boost logo

Boost :

Subject: [boost] [interprocess] Assign to shared_lock from scoped_lock
From: Chard (boost_at_[hidden])
Date: 2009-04-07 16:06:57


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))); ]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk