Is ||= in Ruby thread safe?

后端 未结 2 481
轻奢々
轻奢々 2020-12-17 21:43

Not sure if threads safety even applies to ||=.

Was originally reading about ActiveSupport::Memoizable and wondered about thread safety there.

2条回答
  •  醉话见心
    2020-12-17 22:15

    This great post on thread safety concepts in Ruby by Luca Guidi shows that ||= is not thread-safe (at least in MRI).

提交回复
热议问题