I have written a program that simulates three “consoles” that accept
keyboard input and run concurrently. You can type commands which each
run at different speeds without interfering with other commands. It
works but it’s complex and I think it can be simpler if I have each
command run in it’s own thread - at the moment I don’t use threads at
So I have been creating threads to test and playing with priorities.
I’d like to be able to control the speed at which processes run but if
I set a thread to just one priority higher than another, it is
scheduled tens of thousands of times more often.
- What do the priorities actually mean?
- If I have to slow one thread just a little, that means messy
sleep() commands on every second line. Is there a way I can call just
parts of a passed-in block?
ie. can I do something similar to this:
block.each_command do |c|
If it’s too much magic I’ll just intersperse with sleep, just thought
there might be a better way.