Added condition variable to sleep on read write lock.