Skip to content

Commit 6dcdd1a

Browse files
committed
Add semaphore doc text
1 parent db803ee commit 6dcdd1a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/concurrent/atomic/semaphore.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@ def try_acquire_timed(permits, timeout)
153153
if RUBY_PLATFORM == 'java'
154154

155155
# @!macro semaphore
156+
#
157+
# A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each {#acquire} blocks if necessary
158+
# until a permit is available, and then takes it. Each {#release} adds a permit,
159+
# potentially releasing a blocking acquirer.
160+
# However, no actual permit objects are used; the Semaphore just keeps a count of the number available and
161+
# acts accordingly.
156162
class JavaSemaphore
157163
# @!macro semaphore_method_initialize
158164
def initialize(count)

0 commit comments

Comments
 (0)