Re: introducing ceph::mutex

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 25, 2018 at 1:57 AM Casey Bodley <cbodley@xxxxxxxxxx> wrote:
>
>
>
> On 09/24/2018 01:39 PM, Sage Weil wrote:
> > On Mon, 24 Sep 2018, Patrick Donnelly wrote:
> >>> - The only code that has been converted to ceph::mutex so far is Finisher.
> >>> You can see what that transition looks like here:
> >>>
> >>>          https://github.com/ceph/ceph/pull/24133/commits/8535965ba4298537c489897ccb191a0f458d60d7
> >>>
> >>>    - lock("Foo::lock") -> lock(ceph::make_mutex("Foo::lock")) in ctor
> >> It's odd seeing what looks like a move/copy constructed mutex. If I'm
> >> understanding the `make_mutex` code correctly, this just selectively
> >> discards the arguments to the lock ctor if not debug mode?
> > Right.  I'm fuzzy on the underlying mechanics of the factory function, but
> > it seems to work!
> >
> > sage
>
> While this looks like it's trying to use mutex's deleted move
> constructor, the factory function relies on return value optimization
> (now guaranteed in c++17) in order to construct the mutex in place.

yeah, it's now known as "copy elision", so namely not considered an
optimization anymore in C++17 =). so we are safe.

to avoid repeated work, i am switching src/auth to debug::mutex, see
https://github.com/ceph/ceph/pull/24263 .

-- 
Regards
Kefu Chai



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux