- Added more rwlock type checking.
- The rwlock_type_checking test should now no longer trigger a sporadic
deadlock.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10639 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/tests/rwlock_type_checking.c b/drd/tests/rwlock_type_checking.c
index ddcd5c0..e4697af 100644
--- a/drd/tests/rwlock_type_checking.c
+++ b/drd/tests/rwlock_type_checking.c
@@ -10,6 +10,7 @@
#include <pthread.h>
#include <stdio.h>
+#include <string.h>
#include "../../config.h"
#include "../../drd/drd.h"
@@ -17,14 +18,15 @@
int main(int argc, char** argv)
{
pthread_rwlock_t posix_rwlock;
- int user_defined_rwlock;
+ pthread_rwlock_t user_defined_rwlock;
+ memset(&user_defined_rwlock, 0, sizeof(user_defined_rwlock));
ANNOTATE_RWLOCK_CREATE(&user_defined_rwlock);
pthread_rwlock_init(&posix_rwlock, 0);
- pthread_rwlock_rdlock((pthread_rwlock_t*)&user_defined_rwlock);
+ pthread_rwlock_init((pthread_rwlock_t*)&user_defined_rwlock, 0);
- ANNOTATE_READERLOCK_ACQUIRED(&posix_rwlock);
+ ANNOTATE_READERLOCK_RELEASED(&posix_rwlock);
pthread_rwlock_destroy(&posix_rwlock);
ANNOTATE_RWLOCK_DESTROY(&user_defined_rwlock);