add resource counting aka 'inverse semaphore' to Semaphore module.