1
0
Fork 0
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:
Jeremy Daer 2016-04-24 09:56:34 -07:00
parent 24b1bb1a0f
commit 65b6496ee4
No known key found for this signature in database
GPG key ID: AB8F6399D5C60664

View file

@ -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