Выполняет ли "run"
блок в целом в EM (без контекстного переключателя)? И в этом примере, будет ли условие гонки в предложении if
?Являются ли условия гонки в EventMachine?
EventMachine.run {
@current_value = 0
EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080, :debug => true) do |ws|
ws.onopen {
@current_value += 1
if @current_value >= 4 # Race condition?
# Code Block
@current_value = 0
end
ws.onmessage { |msg|
# puts msg
}
ws.onclose {
# puts "disconnected"
}
}
end
end