mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Share lock: more accurate livelock fix for aa598f4
Awaken waiting threads even if the current thread (the previously exclusive thread) hadn't taken a share lock. This only happens in code that wasn't run within an executor, since that always take an outermost share lock.
This commit is contained in:
parent
24b1bb1a0f
commit
65b6496ee4
1 changed files with 2 additions and 3 deletions
|
@ -69,7 +69,6 @@ module ActiveSupport
|
|||
|
||||
if eligible_waiters?(compatible)
|
||||
yield_shares(compatible: compatible, block_share: true) do
|
||||
@cv.broadcast
|
||||
@cv.wait_while { @exclusive_thread || eligible_waiters?(compatible) }
|
||||
end
|
||||
end
|
||||
|
@ -145,9 +144,9 @@ module ActiveSupport
|
|||
end
|
||||
compatible |= [false] unless block_share
|
||||
@waiting[Thread.current] = [purpose, compatible]
|
||||
|
||||
@cv.broadcast
|
||||
end
|
||||
|
||||
@cv.broadcast
|
||||
end
|
||||
|
||||
begin
|
||||
|
|
Loading…
Reference in a new issue