replace semaphore counter by generation counter