|
@@ -44,7 +44,9 @@ func (s *Semaphore) Release() {
|
|
|
<-s.sem
|
|
<-s.sem
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// IsEmpty would return true if none acquired ar that moment of time, otherwise false.
|
|
|
|
|
|
|
+// IsEmpty will return true if no tickets are being held at that instant.
|
|
|
|
|
+// It is safe to call concurrently with Acquire and Release, though do note
|
|
|
|
|
+// that the result may then be unpredictable.
|
|
|
func (s *Semaphore) IsEmpty() bool {
|
|
func (s *Semaphore) IsEmpty() bool {
|
|
|
return len(s.sem) == 0
|
|
return len(s.sem) == 0
|
|
|
}
|
|
}
|