1 2 3 4 5 6 7 8 9
require 'securerandom' @mutex = Mutex.new on_thread_shutdown do @mutex.synchronize do File.write("./cookie_thread_shutdown.#{SecureRandom.hex}", "shutdown") end end