Commit Graph

28 Commits

Author SHA1 Message Date
Akira Matsuda
14eb6b2794 ShareLock#exclusive and sharing are both public methods 2020-10-02 15:53:47 +09:00
Akira Matsuda
339151204d ShareLock#sharing and Object#tap are both public methods 2020-10-02 15:53:47 +09:00
Michael Grosser
203998c916
allow running each test with pure ruby path/to/test.rb
also:
 - makes test dependencies obvious
 - makes tests runnable from within subfolders
2019-12-18 08:49:19 -06:00
Ryuta Kamizono
c81af6ae72 Enable Layout/EmptyLinesAroundAccessModifier cop
We sometimes say "✂️ newline after `private`" in a code review (e.g.
https://github.com/rails/rails/pull/18546#discussion_r23188776,
https://github.com/rails/rails/pull/34832#discussion_r244847195).

Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style
`EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059).

That cop and enforced style will reduce the our code review cost.
2019-06-13 12:00:45 +09:00
alkesh26
38472af70e ActiveSupport typo fixes. 2019-02-01 22:17:10 +05:30
Ryuta Kamizono
892e38c78e Enable Style/RedundantBegin cop to avoid newly adding redundant begin block
Currently we sometimes find a redundant begin block in code review
(e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205).

I'd like to enable `Style/RedundantBegin` cop to avoid that, since
rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5
(https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with
that situation than before.
2018-12-21 06:12:42 +09:00
Rafael Mendonça França
f679933daa
Change the empty block style to have space inside of the block 2018-09-25 13:19:35 -04:00
Koichi ITO
ac717d65a3 [Active Support] rubocop -a --only Layout/EmptyLineAfterMagicComment 2017-07-11 13:12:32 +09:00
Kir Shatrov
72950568dd Use frozen-string-literal in ActiveSupport 2017-07-09 15:08:29 +03:00
Matthew Draper
87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
2017-07-02 02:15:17 +09:30
Kir Shatrov
cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Rafael Mendonça França
55f9b8129a
Add three new rubocop rules
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces

Fix all violations in the repository.
2016-08-16 04:30:11 -03:00
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
a731125f12 applies new string literal convention in activesupport/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:10:53 +02:00
Matthew Draper
fe7d77cc01 Test the happy path for recursive yields too 2016-02-08 05:30:10 +10:30
thedarkone
5d9e591313 Fix a nonsensical ShareLock test. 2016-02-07 19:13:16 +01:00
thedarkone
9f2df7856d AS::Conc::ShareLock#yield_shares tests. 2016-02-07 01:01:51 +01:00
Matthew Draper
3e4a69e52d Hand off the interlock to the new thread in AC::Live
Most importantly, the original request thread must yield its share lock
while waiting for the live thread to commit -- otherwise a request's
base and live threads can deadlock against each other.
2016-02-07 08:32:27 +10:30
Matthew Draper
f836630f8c After completing a load, give other threads a chance too
While we know no user code is running, we should do as much loading as
we can. That way, all the threads will then be able to resume running
user code together.

Otherwise, only the last arriving thread would get to do its load, and
would then return to userspace, leaving the others still blocked.
2016-02-02 03:21:03 +10:30
Matthew Draper
f02bd2a92c While new sharers are blocked, an existing sharer remains re-entrant 2016-02-02 03:21:03 +10:30
Matthew Draper
aeb58ab704 Block new share attempts if there's an exclusive waiter 2016-02-02 03:21:03 +10:30
Jerry D'Antonio
23b6f65fd1 Require only necessary concurrent-ruby classes. 2015-11-04 21:12:28 -05:00
thedarkone
5d6770754e Small tweaks to mainly lock-ordering tests.
* only test the upgrade path,
* add test to verify non upgrades can’t preempt,
* add reentrancy assertion.
2015-07-22 22:59:01 +02:00
Matthew Draper
e9020ac431 Handle thread death during lock acquisition
Specifically, clean up if the thread is killed while it's blocked
awaiting the lock... if we get killed on some other arbitrary line, the
result remains quite undefined.
2015-07-21 12:03:38 +09:30
Matthew Draper
4c54b2a9a0 Adjust expectations around purpose/compatibility options 2015-07-21 12:03:38 +09:30
Matthew Draper
ef4d334272 Add some meta-assertions for the custom assertions
I accidentally discovered `assert_threads_not_stuck` couldn't fail, so
the simplest solution was to prove they're all now working in both
directions.
2015-07-21 12:00:52 +09:30
Matthew Draper
649d8173c3 Order of execution is only guaranteed if upgrading
If the thread isn't yet holding any form of lock, it has no claim over
what may / may not run while it's blocked.
2015-07-21 08:50:50 +09:30
thedarkone
9c4da24aca Tests for AS::Concurrency::ShareLock. 2015-07-20 19:01:11 +02:00