replace semaphore counters by generation counters