Ruby Multithreading: making one thread wait for a signal from another
- by Peter
In Ruby, I want to have two threads running at the same time, and want the background thread to periodically signal the foreground thread. How do I get the foreground thread to block until the background thread says 'go'? I can think of a few ways to do it, but am after the most appropriate, idiomatic Ruby method.
In code:
loop do # background,…