From 476f59383e6bb357d41416f7e1693ede6350e7bb Mon Sep 17 00:00:00 2001 From: Chalupa Petr Date: Fri, 6 Jul 2018 16:02:35 +0200 Subject: [PATCH] Document downgrading and upgrading of ReentrantReadWriteLock --- lib/concurrent/atomic/reentrant_read_write_lock.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/concurrent/atomic/reentrant_read_write_lock.rb b/lib/concurrent/atomic/reentrant_read_write_lock.rb index 3f29169bd..42d7f3c3e 100644 --- a/lib/concurrent/atomic/reentrant_read_write_lock.rb +++ b/lib/concurrent/atomic/reentrant_read_write_lock.rb @@ -21,7 +21,9 @@ module Concurrent # also acquire a read lock OR a write lock more than once. Only when the read (or # write) lock is released as many times as it was acquired, will the thread # actually let it go, allowing other threads which might have been waiting - # to proceed. + # to proceed. Therefore the lock can be upgraded by first acquiring + # read lock and then write lock and that the lock can be downgraded by first + # having both read and write lock a releasing just the write lock. # # If both read and write locks are acquired by the same thread, it is not strictly # necessary to release them in the same order they were acquired. In other words,