changing pool mutex to rwlock