Modify read write lock code