in reply to Re: using $SIG as an IPC interrupt?
in thread using $SIG as an IPC interrupt?

Right now I am polling the file every 200ms and looking for the contents to change (ie. to be appended to).

The Perl application includes a substantial Tk GUI interface component, and it also writes files to send messages to other applications, is doing some computations for the GUI interface, etc. Its doing other things but when a message comes in from this C application that is the 'high priority' task and should be processed as soon as possible.

Data does not stream in large volumes per se, but when new data is there it is highly desireable to process it as soon as possible.

Replies are listed 'Best First'.
Re^3: using $SIG as an IPC interrupt?
by pileofrogs (Priest) on Aug 21, 2008 at 19:54 UTC

    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?

Re^3: using $SIG as an IPC interrupt?
by shmem (Chancellor) on Aug 22, 2008 at 09:39 UTC

    Since you are using Tk, you could hook in POE's POE::Component::DirWatch. The DirWatch session is given time slices within the Tk event loop, so unless the GUI is clogged it should deliver directory changes fairly quick. For immediate processing you would use signals and a signal handler.