in reply to problems on signal handling, Glib mainloop, and named pipe

Named Pipes says:

When you open a fifo, the program will block until there’s something on the other end.

If you move the open after setting up your signal handlers, then your signal will be caught and reported. The problem is your program stops in the open. The signal is received before your signal handler is set up and the default action of SIGUSR1 is to terminate your program.

If you have some other process open the fifo for writing, then the open in your perl program will return and your program will carry on. Try running it as is, running another process to open the fifo for write, then send your program a signal.

But, it would probably be best to set up the signal handlers earlier.

  • Comment on Re: problems on signal handling, Glib mainloop, and named pipe

Replies are listed 'Best First'.
Re^2: problems on signal handling, Glib mainloop, and named pipe
by llancet (Friar) on Oct 14, 2010 at 08:10 UTC
    Should I open the fifo inside the signal handler, or I should emit an event to Glib mainloop, and work on the pipe later?

      I guess that depends on why you are opening the fifo and in particular where in your program you want to use it. I don't know about emitting events to Glib mainloop.

      If you describe what you are trying to achieve, someone might be able to give you more guidance.