signal handling and threads - Linux

This is a discussion on signal handling and threads - Linux ; Dear All, I try to do signal handling in a multi threaded program. It is written in C using gcc (glib and gnet). I can receive SIGHUP and a signalhandler is called. This works fine. Now my question is: If ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: signal handling and threads

  1. signal handling and threads

    Dear All,

    I try to do signal handling in a multi threaded program. It is written
    in C using gcc (glib and gnet).

    I can receive SIGHUP and a signalhandler is called. This works fine.

    Now my question is: If the signal handler is executed, are all threads
    (which I started using glib functions) interrupted or only the main
    program?

    Thank you very much.

    Kind regards,
    Christian


  2. Re: signal handling and threads

    On Wed, 25 Jul 2007 04:00:02 -0700, kiksen1@gmx.de wrote:
    > Now my question is: If the signal handler is executed, are all threads
    > (which I started using glib functions) interrupted or only the main
    > program?


    Only the thread that handles the signal, which may or may not be the
    "main program" depending on your thread signal masks.

    It's usually a good idea to have only one known thread that has a
    receptive signal mask and block them from all others; in this way,
    async signals to the process will always trigger the handler on
    that spesific thread.

    --
    Mikko Rauhala - mjr@iki.fi - http://www.iki.fi/mjr/ >
    Transhumanist - WTA member - http://transhumanism.org/ >
    Singularitarian - SIAI supporter - http://singinst.org/ >

+ Reply to Thread