Title / Description
Code threads = [] mutex = Mutex.new quit = false threads << Thread.new do while !mutex.synchronize{quit} # Uhrzeit abrufen # Ausgabe an Statuszeile end end threads << Thread.new do while !mutex.synchronize{quit} # Mails abrufen # Ausgabe an Statuszeile sleep 300 # Oder wie du willst end end trap(:SIGTERM) do mutex.synchronize{quit = true} end sleep 5 while !mutex.synchronize{quit} threads.each(&:join)
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code