From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32118 invoked by alias); 8 Jul 2002 14:08:11 -0000 Mailing-List: contact ecos-discuss-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@sources.redhat.com Received: (qmail 32108 invoked from network); 8 Jul 2002 14:08:09 -0000 Received: from unknown (HELO hhlx01.visionsystems.de) (62.145.30.242) by sources.redhat.com with SMTP; 8 Jul 2002 14:08:09 -0000 Received: from kallisto.intra.visionsystems.de (kallisto.intra.visionsystems.de [192.168.1.3]) by hhlx01.visionsystems.de (8.11.1/8.10.2/SuSE Linux 8.10.0-0.3) with ESMTP id g68E84d21001 for ; Mon, 8 Jul 2002 16:08:08 +0200 Message-Id: <200207081408.g68E84d21001@hhlx01.visionsystems.de> Received: from there (development1.intra.visionsystems.de [192.168.1.36]) by kallisto.intra.visionsystems.de with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2448.0) id 3PK3AL56; Mon, 8 Jul 2002 16:08:05 +0200 Content-Type: text/plain; charset="iso-8859-1" From: Roland =?iso-8859-1?q?Ca=DFebohm?= To: ecos-discuss@sources.redhat.com Date: Mon, 08 Jul 2002 07:08:00 -0000 References: <200207040822.g648Lvd13551@hhlx01.visionsystems.de> <200207040933.g649XUd13697@hhlx01.visionsystems.de> <200207041205.g64C57d14137@hhlx01.visionsystems.de> In-Reply-To: <200207041205.g64C57d14137@hhlx01.visionsystems.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [ECOS] Signal handling X-SW-Source: 2002-07/txt/msg00067.txt.bz2 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