in reply to Perl thread/semaphore

You may use the same values or the default values for constructor, up and down operations...

Replies are listed 'Best First'.
Re^2: Perl thread/semaphore
by imrags (Monk) on Jan 22, 2009 at 09:05 UTC
    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 ...
    Raghu