add read-write lock support (not tested)