bfish has asked for the wisdom of the Perl Monks concerning the following question:

You people are great and solved my first problem in a hurry--THANKS!

Now I'd like to see if there is a way for one of my processes to interrupt another. I envision sending a signal from one server-type process to a client-type process. The client would abort current processing upon receiving the signal, read a bunch of stuff from a Win32::Pipe, and then start its processing again.

Since I'm running under Windows, I'm very leary of using SIG or anything that expects a UNIX OS. If I shouldn't be, just let me know, but my investigation into named pipes (solved with Win32::Pipe) suggests that I'm properly concerned.

The biggest trick seems to be that I don't want the client to be reentrant. I want to interrupt the client and never return to the position at which the client was running (figuratively issue a GOTO type of command).

Here is the application (basically)...my primary process is managing a fantasy football draft, my secondary process searches for a trade that might be beneficial to me. Since there are many trade possibilities, I want to investigate as many as it can. Unfortunately, the whole structure changes each time someone makes a draft pick. Thus I want to interrupt the secondary process wheneve a pick is made, send information about the pick selected over, and then tell the secondary process to start looking for a new potential trade. Fun, huh?

  • Comment on Sending and Catching Signals/Interrupts

Replies are listed 'Best First'.
Re: Sending and Catching Signals/Interrupts
by waswas-fng (Curate) on Aug 07, 2003 at 18:55 UTC
    Have you lookd at POE? this is the type of proccess that I think would be a very good fit.

    -Waswas

      I see what you mean, and I think there might be something here...one problem I've noted is that I can't have two POE sessions running at once, but that is exactly what I need (both the draft program and the trade program).

      I got this impression from the following link poe.perl.org:

      POE's event handlers are cooperative. No two handlers may run at once. Even POE's dispatcher is suspended while an event handler is running. Handlers therefore have an opportunity to monopolize a program. They cooperate by returning as quickly as possible, allowing other parts of the program to run with only minimal delays.
        Look at how POE::Component::Client::HTTP does it, (no the best example, but I am working off the top of my head here before a meeting) it spawns multiple gets at the same time, you can use the same logic.

        -Waswas