This macro validates that a given lock is taken by using
pthread_mutex_trylock().
The use of this macro is disouraged in hot paths for performance
reasons. It is meant to catch errors in "cold" code path (e.g. error
handling) where the additional safety it provides has no material
effect on performance.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
#define member_sizeof(type, field) sizeof(((type *) 0)->field)
+#define ASSERT_LOCKED(lock) assert(pthread_mutex_trylock(&lock))
+
/*
* lttng_strncpy returns 0 on success, or nonzero on failure.
* It checks that the @src string fits into @dst_len before performing