Make reference counting of blocks atomic.