[ECOS] Question about PThreads and signals

Alexander Aganichev aaganichev@gmail.com
Fri Sep 18 13:45:00 GMT 2009


Just wondering if the problem I'm running in is known or I'm doing
something wrong. I modified TCP/IP stack to send SIGIO signal to the
POSIX thread with pthread_kill like this:

	if (so->so_state & SS_ASYNC)
		pthread_kill(so->so_pgid, SIGIO);

I also modified the code to properly set so_pgid field and double
check that. From the user code I have the following:

	sigaddset( &signals, SIGIO );
	pthread_sigmask( SIG_BLOCK, &signals, &oldSignals );

	while ( pGlobalParams->State == EventTask_Running )
		sigwait( &signals, &sig );

And sigwait() not wakes on the signal from TCP/IP stack. The root of
the problem seems to be in the cyg_sigqueue() code, which do the

    if( thread != NULL )
        sigaddset( &thread->sigpending, signo );
        // just wake the thread up now if it's blocked somewhere
        if ((thread->sigpending & ~thread->sigmask) != 0)

I think that thread->sigmask should not be used non-inverted here, so
that's why my thread is not waked (have not tested the reverted
condition though). Can anyone please comment if I'm right? Thanks in

WBR, Alexander

Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

More information about the Ecos-discuss mailing list