Skip to content

Commit 476f593

Browse files
authored
Document downgrading and upgrading of ReentrantReadWriteLock
1 parent 0e1d60e commit 476f593

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/concurrent/atomic/reentrant_read_write_lock.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ module Concurrent
2121
# also acquire a read lock OR a write lock more than once. Only when the read (or
2222
# write) lock is released as many times as it was acquired, will the thread
2323
# actually let it go, allowing other threads which might have been waiting
24-
# to proceed.
24+
# to proceed. Therefore the lock can be upgraded by first acquiring
25+
# read lock and then write lock and that the lock can be downgraded by first
26+
# having both read and write lock a releasing just the write lock.
2527
#
2628
# If both read and write locks are acquired by the same thread, it is not strictly
2729
# necessary to release them in the same order they were acquired. In other words,

0 commit comments

Comments
 (0)