Re: s/Mutex/ceph::mutex/, lockdep

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

 



On Tue, 13 Mar 2018, Adam C. Emerson wrote:

I'm not sure if it's worth trying to keep something like this around
for the debug_mutex... I think we'd need to create some sort of
macro like ASSERT_MUTEX_LOCKED(lock) that compiles away to nothing
in the std::mutex case?

If you /reallyreallyreally/ want something like this, then the way I
would want to do it is pass in a reference (possibly const) to a
unique_lock:

And have a macro like:

#define ASSERT_MUTEX_HELD(ul, m) \
 ceph_assert(ul.mutex() == m && ul.owns_lock())

This way we can have our assertions whether we have the Magic Debug
Mutex or not.

Alternatively we could make our own templatized Fancy Schmancy version
of lock guard templatized on the mutex of the class and just have
functions that require a reference to it be passed in in the type
signature. This saves us from runtime checks, at least.

Agreed, except I would absolutely not use the macro and definitely would recommend a template. (I just had a run-in with some macros...)

-Jesse
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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