Add an ASSERT_LOCKED(lock) macro
[lttng-tools.git] / src / common / macros.h
index 33ada7321801a14b438a27dca246ec8fbfb0c897..c42cddd5050ca163a612e9f1744f9b7aaf03da5b 100644 (file)
@@ -79,6 +79,10 @@ void *zmalloc(size_t len)
 #define min(a, b) ((a) < (b) ? (a) : (b))
 #endif
 
+#ifndef min_t
+#define min_t(type, a, b)      ((type) min(a, b))
+#endif
+
 #ifndef LTTNG_PACKED
 #define LTTNG_PACKED __attribute__((__packed__))
 #endif
@@ -102,6 +106,8 @@ void *zmalloc(size_t len)
 
 #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
This page took 0.026211 seconds and 5 git commands to generate.