Class: RuboCop::Cop::Legion::Framework::MutexNestedSync
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Legion::Framework::MutexNestedSync
- Defined in:
- lib/rubocop/cop/legion/framework/mutex_nested_sync.rb
Overview
Detects ‘synchronize` blocks nested inside other `synchronize` blocks, which risks deadlock if the same mutex is re-acquired. Even with different mutexes, nested locks require consistent ordering to avoid deadlock.
Constant Summary collapse
- MSG =
'Nested `synchronize` detected. Risk of deadlock if the same mutex is re-acquired ' \ 'or if lock ordering is inconsistent.'
Instance Method Summary collapse
Instance Method Details
#on_block(node) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/rubocop/cop/legion/framework/mutex_nested_sync.rb', line 28 def on_block(node) return unless synchronize_call?(node) return unless nested_inside_synchronize?(node) add_offense(node.send_node) end |