#define _GNU_SOURCE #include #include #include #include #include #include "utils.h" /* * Output an error fprintf style to stderr and abort. */ void utils_fatal_error(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); abort(); } /* * This method can only be used to assert that a thread is holding * a lock. It will flag a warning in Helgrind that is reasonable * to suppress. */ bool utils_is_lock_held(pthread_mutex_t *lock) { return lock->__data.__owner == gettid(); }