From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Larmour To: "Boris V. Guzhov" Cc: ecos-discuss@sourceware.cygnus.com Subject: Re: [ECOS] select() and signal's Date: Fri, 20 Apr 2001 06:57:00 -0000 Message-id: <3AE0404E.B3BE865C@redhat.com> References: <01b701c0c996$c29891f0$7601a8c0@borg> X-SW-Source: 2001-04/msg00264.html "Boris V. Guzhov" wrote: > > Hi, > > Are there any way in eCos to interrupt the select() blocking > through a sending of a any signal? > > For instance: > > // posix thread 1: > void *thr1(void *par) > { > struct sigaction sa; > sigset_t mask; > > sigemptyset( &mask ); > sigaddset( &mask, SIGRTMIN ); > pthread_sigmask( SIG_UNBLOCK, &mask, 0 ); > > sigemptyset( &sa.sa_mask ); > sa.sa_flags = SA_SIGINFO; > sa.sa_sigaction = my_sig_handler; > sigaction( SIGTRTMIN, &sa, NULL); > > fd_set rfds; > int retval; > > FD_ZERO(&rfds); > FD_SET(0, &rfds); > retval = select(1, &rfds, NULL, NULL, NULL); > if ( retval < 0 ) > perror("select:"); > ... > } > > // posix thread 2: > void *thr2(void *par) > { > ... > pthread_kill( th1, SIGRTMIN) ; > ... > } > > In Linux it works, but in eCos it not works. It is meant to work in eCos. It's meant to return -1 and set errno to EINTR. Are you sure thr1 isn't being pre-empted for any other reason, e.g. if thr2 is higher priority. Try setting a breakpoint on the function cyg_sigqueue and debugging it. jifl -- Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062 Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine