Index: lib/libthr/thread/thr_rwlock.c =================================================================== --- lib/libthr/thread/thr_rwlock.c (revision 197623) +++ lib/libthr/thread/thr_rwlock.c (working copy) @@ -26,15 +26,22 @@ * $FreeBSD$ */ +#include #include #include #include +#include + #include "namespace.h" #include #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 +81,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; }