http://en.wikipedia.org/wiki/Semaphore_(programming)
http://www.tin.org/bin/man.cgi?section=3&topic=sem_init
You initialise the semaphore to some N
You're allowed to call sem_wait() N times in succession before blocking.
At some point, there will be N sem_post() calls to return the semaphore to it's initial state.
Are you saying you want to change N after you've created it?