Upgrade to Pro — share decks privately, control downloads, hide ads and more …

竝行

 竝行

Rubyと竝行
concurrent/pararell

さっちゃん

September 14, 2017
Tweet

More Decks by さっちゃん

Other Decks in Programming

Transcript

  1. Thread thread1 = Thread.new { } thread2 = Thread.new {

    } [thread1, thread2].each &:join Concurrent
  2. Concurrent Ruby https://github.com/ruby-concurrency/concurrent-ruby class Echo include Concurrent::Async def echo(msg) print

    "#{msg}\n” end End horn = Echo.new horn.async.echo 'oneʼ horn.await.echo 'two' Concurrent
  3. EventMachine https://github.com/eventmachine/eventmachine/ EM::run do client = MyApp.new give_tick = proc

    do Gtk::main_iteration_do false EM.next_tick give_tick end give_tick.call end Concurrent