Open ghost opened 10 years ago
You don't need event machine to do this, ruby threads work just fine.
checker_thread = Thread.new do
loop do
check_your_sensors
sleep 1 # or however many seconds you want to sleep
end
end
Now that you have a reference to that thread, you can join or kill it as you please.
I like the idea! It's something I've thought about before.
Unfortunately, work and personal life have me swamped lately. So I doubt I'll be able to get to this in short order. Though, I'd never say "no" to a pull request :smile:
Would it be possible to add a feature so we can enter an event loop and beforehand setup functions that would run every x milliseconds? This way we can concurrently check for different sensors. I know I could do this with event machine but it seems that would defeat the purpose of this library if its supposed to be event driven.