This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Signal handling


On Thursday, 4. July 2002 14:05, Roland Caßebohm wrote:
> On Thursday, 4. July 2002 11:33, Roland Caßebohm wrote:
> > On Thursday, 4. July 2002 10:21, Roland Caßebohm wrote:
> > > Hi,
> > >
> > > I send signals with pthread_kill() from the snmp agent, which is not a
> > > pthread, to other threads, which are pthreads.
> > > If I send a signal from the snmp agent to the main thread it receives
> > > it. But if I send a signal to another thread, which is created from
> > > main it doesn't take effect.
> > > But if I send the same signal from another pthread not from the snmp
> > > agent it works.
> > >
> > > Why does it not work from the snmp agent thread to another pthread than
> > > main?
> > >
> > > Thanks you,
> > > Roland
> >
> > I have changed the initialisation code of the snmp agent, so that it is a
> > pthread and now it works.
>
> I think I have been glad to early. The first pthread which is created by
> main() gets the signal. But another which is created by the snmp agent
> pthread does not recognize the signal.

I found out now that the asr-function which calls the signal_handler is not 
called because asr_inhibit is still set when the scheduler tries to call the 
asr (asr_pending is set).

The thread which should receive the signal is or better should be in sleep 
mode. It has called select() which has called Cyg_Condition_Var::wait_inner() 
which has called Cyg_Scheduler::unlock_reschedule().
If the signal was sent, the thread comes out of unlock_reschedule(). The wake 
reason should the be BREAK but is DONE.
In pthread_kill() the thread should be released - the function cyg_sigqueue() 
calls thread->thread->release() to do that. But when calling 
Cyg_Thread::release(), the sleep reason is NONE but should be WAIT, so the 
wake reason will not be modified and the thread will not wake up.

So why is the sleep reason not WAIT?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]