rwsem implementation