PKI_RWLOCK_write_lock() patch applied for environments where pthreads' RWLOCK is not available