Remove deadlock that was caused by calling pthread_rwlock_wrlock() on same thread...