from panda3d.core import Semaphore
- class Semaphore
A classic semaphore synchronization primitive.
A semaphore manages an internal counter which is decremented by each
acquire()call and incremented by each
release()call. The counter can never go below zero; when
acquire()finds that it is zero, it blocks, waiting until some other thread calls
Decrements the internal count. If the count was already at zero, blocks until the count is nonzero, then decrements it.
- getCount() int
Returns the current semaphore count. Note that this call is not thread- safe (the count may change at any time).
- release() int
Increments the semaphore’s internal count. This may wake up another thread blocked on
Returns the count of the semaphore upon release.