long count = value; // value must be >= 0
// local counting semaphore
TLocalCountingSemaphore* localCountingSem = new TLocalCountingSemaphore(count);
// global counting semaphore
TGlobalCountingSemaphoreHandle* globalCountingSem =
new TGlobalCountingSemaphoreHandle(count);