code: func (s *Semaphore) AvailablePermits() int {
  	s.pMutex.RLock()
  	defer s.pMutex.RUnlock()
  
  	if s.avail < 0 {
  		return 0
  	}
  	return s.avail
  }
docs: // AvailablePermits gives number of available unacquired permits.