Making Lazy Accessors Thread-Safe | Greg Navis
28-Apr-2023 880
Lazy accessors were defined via means of a new method on Class called lazy. Let’s have another look at its source code to understand why it’s not thread-safe. If multiple threads call the accessor for the first time then there’s a race condition that can cause the initial value to be calculated multiple times.
Making Lazy Accessors Thread-Safe | Greg Navis #ruby #rubydeveloper #rubyonrails #Making #Accessors #Thread-Safe #Navis #thread-safe https://rubyonrails.ba/link/making-lazy-accessors-thread-safe-greg-navis