NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [Signal handler] Bug or feature ?



Pongthep Kulkrisada a écrit :
* BERTRAND Jol (joel.bertrand%systella.fr@localhost) wrote:
volatile int flag;

flag = 0;

do
{
        code_retour = nanosleep(&temporisation,&temporisation);
        erreur = errno;

        if (flag == 1)
        {
                exit(0);
        }
} while((code_retour == -1)&&  (erreur == EINTR));

SIGINT signal handler is :

void
interruption1(int signal)
{
        flag = 1;
        return;
}

When this process receives SIGINT, it doesn't exit. I have verified
that signal handler is called and it is.
If there is nothing wrong, it is very strange.
I tried coding exactly what you did.
On my 6.0_RC2 (i386), it does ``exit'' after SIGINT delivered to the process.

I have tested on 5.1.2 (amd64) and this test program is linked with -pthread.

But nanosleep() returns with EINTR error before signal handler is called.
On my machine, I can verify that signal handler is called before nanosleep() 
returns.

Not on mine. Even thread id is different between signal handler and main program.

        I have found a workaround. Thus I consider this post closed.

        Thanks a lot,

        JKB


Home | Main Index | Thread Index | Old Index