Comments (3)
I agree with your analysis. The example code doesn't look like there is a threading problem to me.
The pattern that I have noticed is this kind of code is thread-safe when it is invoked at boot-time, but not thread-safe when invoked at run-time. Since you're calling set(true)
and set(false)
in the children classes while they are being loaded, that should always be safe. The cop can't know about all the callsites, so it can't know that this is safe usage.
from rubocop-thread_safety.
great, thanks for replying and confirming it! I will close this one
from rubocop-thread_safety.
great, thanks for replying and confirming it! I will close this one
from rubocop-thread_safety.
Related Issues (15)
- Consider disallowing ivars in methods of any module HOT 1
- avoid duplicated CI builds on PR pushes HOT 1
- False positive: ThreadSafety/InstanceVariableInClassMethod in anonymous classes
- Detect ivars in Rack middleware
- False positive: ivar in Structs HOT 1
- Detect class_eval as class context
- Incompatibility with Rubocop 1.45.0 HOT 2
- Time for a new release? HOT 5
- Parser error when using inline helper_method HOT 1
- Description/Reasoning for the current rules being enforced by default HOT 4
- False Positive: ivar in dynamic method definition of Class.new
- Can we have a cop to recommend not using Dir.chdir? HOT 1
- False positive with before_action set in class method
- Support detecting offenders in `ActiveSupport::Concern#class_methods` blocks
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rubocop-thread_safety.