Rails 应用程序中的线程安全
最近我在 Ruby 中听到了很多关于线程安全的内容。我的问题是,如何确定我的rails应用程序(实际上是开源项目refinerycms)是否是线程安全的?
I've been hearing a lot about thread safety lately in Ruby. My question is, how do I determine whether or not my rails app (actually the open source project refinerycms) is thread safe or not?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有简单的方法来确定应用程序是否是线程安全的。
但是,如果存在类变量,并且使用了线程,那么应用程序很可能不使用线程,因为它需要适当的同步(许多开发人员只是忽略了这一点)。
此外,这个问题不可能客观地回答,因为您关心的是 Ruby 中的线程安全性,但询问特定的应用程序是完全不同的事情。
There is no easy way to determine whether the application is thread-sage or not.
But if there are class variables, Threads are used then it is very likely that the app is not because it requires proper synchronization (which many developers just ignore).
Additionally, the question is impossible to objectively answer because you are concerned about thread-safety in Ruby, but asking about a particular application which are totally different things.