def getvalue(self):
        """The current value of the semaphore."""
        from ctypes import c_int, byref

        sval = c_int()
        if self._sem_getvalue(self.sem_p, byref(sval)):
            raise SemError()
        return sval.value
The current value of the semaphore.
recipes/Python/577655_POSIX_Semaphore_FreeBSD/recipe-577655.py