From 878f968eeb852383ff79dc3f181db24e5b52fd75 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Thu, 13 Jun 2013 18:41:19 -0400 Subject: liblockdep: Add pthread_mutex_t test suite This is a rather simple and basic test suite to test common locking issues. Beyond tests, it also shows how to use the library. Signed-off-by: Sasha Levin Signed-off-by: Peter Zijlstra Cc: torvalds@linux-foundation.org Link: http://lkml.kernel.org/r/1371163284-6346-5-git-send-email-sasha.levin@oracle.com Signed-off-by: Ingo Molnar --- tools/lib/lockdep/tests/common.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tools/lib/lockdep/tests/common.h (limited to 'tools/lib/lockdep/tests/common.h') diff --git a/tools/lib/lockdep/tests/common.h b/tools/lib/lockdep/tests/common.h new file mode 100644 index 000000000000..d89e94d47d86 --- /dev/null +++ b/tools/lib/lockdep/tests/common.h @@ -0,0 +1,12 @@ +#ifndef _LIBLOCKDEP_TEST_COMMON_H +#define _LIBLOCKDEP_TEST_COMMON_H + +#define LOCK_UNLOCK_2(a, b) \ + do { \ + pthread_mutex_lock(&(a)); \ + pthread_mutex_lock(&(b)); \ + pthread_mutex_unlock(&(b)); \ + pthread_mutex_unlock(&(a)); \ + } while(0) + +#endif -- cgit v1.2.3