This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def Timeout.wake(secs) | |
Thread.handle_interrupt(Timeout::Error => :on_blocking) do | |
Timeout.timeout(secs) do | |
yield | |
end | |
end | |
end | |
N = 100 | |
SECS = 0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
if ENV['B'] | |
BuiltinRactor = Ractor | |
Object.send :remove_const, :Ractor | |
require 'backports/3.0.0/ractor' | |
puts "Using pure Ruby implementation" | |
end | |
# usage `ruby ractor_test.rb <work_length> <num_workers> <num_requests> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Bobby.ExVcrProcess do | |
@moduledoc """ | |
This GenServer allows calling `start_cassette` / `stop_cassette` from any process | |
# Instead of | |
use_cassette("x") do | |
do_something | |
end | |
# can be written as (each line from any process): |
OlderNewer