Hello,
May I ask if ruby is thread safety for using the already thread-safe
libraries?
THANKS
Hello,
May I ask if ruby is thread safety for using the already thread-safe
libraries?
THANKS
Thread safety is not a property of a programming language and only to a
certain extend of library code. Ultimately it is a property of a particular
application that requires work to make it thread safe. You cannot just take
e.g. a synchronized version of a container and automatically obtain a
thread safe application.
Example: let us assume h is a Hash where all methods are synchronized on
the same lock. Then this code is not thread safe because h could be
modified between this thread executes the first and second line:
if h.has_key?(x) then
puts h.fetch(x)
end
Cheers
robert
On Thu, Dec 23, 2021 at 8:32 AM Wes Peng <pentwes@gmail.com> wrote:
May I ask if ruby is thread safety for using the already thread-safe
libraries?
--
[guy, jim, charlie, sho].each {|him| remember.him do |as, often| as.you_can
- without end}
http://blog.rubybestpractices.com/