Change semaphores into resource counters.