optimized rw spin lock algorithm from TBB