That is to control number of threads...
in this, max number of threads can be 2 and not more than 2...at least that is what i want to achieve..
Logic is thus:
Initially a thread goes to the subroutine, decrements semaphore (which = 2 earlier), another thread also decrements it (so sem = 0)
so no more threads can access it... that's why i used the sem down<->up ...
| [reply] |