use mutex and condition variable to implement rwlock