Ruby - Concurrent Programming
Examine this Ruby code snippet:
What issue might still arise despite using a Mutex here?
mutex = Mutex.new
counter = 0
threads = 4.times.map do
Thread.new do
25.times do
mutex.synchronize { counter += 1 }
end
end
end
threads.each(&:join)
puts counterWhat issue might still arise despite using a Mutex here?
