You should seriously consider multiple threads or multiple processes. This is the kind of thing they do really well.
Did you say what OS you're on? Can you use Inotify?
In reply to Re^3: using $SIG as an IPC interrupt?
by pileofrogs
in thread using $SIG as an IPC interrupt?
by bobbob
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |