Ruby - Concurrent Programming
Find the problem in this Ruby code:
mutex = Mutex.new
counter = 0
threads = 2.times.map do
Thread.new do
3.times do
mutex.lock
counter += 1
end
mutex.unlock
end
end
threads.each(&:join)
puts counter