Index: thread/thr_rwlock.c =================================================================== --- thread/thr_rwlock.c (revision 197623) +++ thread/thr_rwlock.c (working copy) @@ -26,6 +26,7 @@ * $FreeBSD$ */ +#include #include #include #include @@ -35,6 +36,10 @@ #include "un-namespace.h" #include "thr_private.h" +#ifdef NDEBUG +#error "This should compiled with debugging options on" +#endif + __weak_reference(_pthread_rwlock_destroy, pthread_rwlock_destroy); __weak_reference(_pthread_rwlock_init, pthread_rwlock_init); __weak_reference(_pthread_rwlock_rdlock, pthread_rwlock_rdlock); @@ -74,6 +79,11 @@ prwlock = *rwlock; *rwlock = NULL; + assert(prwlock.owner == NULL); + assert(prwlock.lock.rw_state == UMUTEX_UNOWNED); + assert(prwlock.lock.rw_flags == 0x00); + assert(prwlock.lock.rw_blocked_readers == 0); + assert(prwlock.lock.rw_blocked_writers == 0); free(prwlock); ret = 0; }