From owner-freebsd-hackers Mon Dec 21 11:52:51 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA13409 for freebsd-hackers-outgoing; Mon, 21 Dec 1998 11:52:51 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from tornado.cisco.com (tornado.cisco.com [171.69.104.22]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA13389 for ; Mon, 21 Dec 1998 11:52:43 -0800 (PST) (envelope-from lching@cisco.com) Received: from lching-pc.cisco.com (lching-pc.cisco.com [171.69.206.55]) by tornado.cisco.com (8.8.5-Cisco.1/8.6.5) with ESMTP id OAA00903; Mon, 21 Dec 1998 14:52:32 -0500 (EST) Received: from cisco.com (localhost.cisco.com [127.0.0.1]) by lching-pc.cisco.com (8.8.8/8.8.8) with ESMTP id OAA08528; Mon, 21 Dec 1998 14:53:21 -0500 (EST) (envelope-from lching@cisco.com) Message-ID: <367EA731.BFAB48C3@cisco.com> Date: Mon, 21 Dec 1998 14:53:21 -0500 From: Larry Ching X-Mailer: Mozilla 4.04 [en] (X11; I; FreeBSD 2.2.6-RELEASE i386) MIME-Version: 1.0 To: Daniel Eischen CC: hackers@FreeBSD.ORG, lching@cisco.com Subject: Re: pthreads question References: <199812211933.OAA01713@pcnet1.pcnet.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Daniel Eischen wrote: > Larry Ching wrote: > > > > A quick glance of the code shows that this is what happens only > > > if the signal is blocked in the thread. If the signal is unblocked, > > > then the thread should return with EINTR. Use sigprocmask(2) to > > > unblock the signal in the thread that you want to interrupt. > > > > Thank you for your help above. The thread in question was making acall > > to pthread_sigmask(SIG_UNBLOCK,...) to unblock the signal I > > was using in pthread_kill(). I changed this call to > > sigprocmask(SIG_UNBLOCK, ...) with no effect. The thread remains > > blocked in the read() call and no EINTR error code is returned. > > > > Any suggestions as to where to look next??? > > You haven't set the action for the signal to SIG_IGN, have you? There is this code segment in the thread to be killed: struct sigaction sa; sigset_t setUser1; sa.sa_handler = SigUsr1Handler; sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sigaction(SIGUSR1, &sa, NULL); sigemptyset(&setUser1); sigaddset(&setUser1, SIGUSR1); sigprocmask(SIG_UNBLOCK, &setUser1, NULL); //pthread_sigmask(SIG_UNBLOCK, &setUser1, NULL); where SigUsr1Handler is defined as: void SigUsr1Handler(int signal) { } My understanding is that this guarantees the action to not be SIG_IGN. I don't understand why this is not sufficient for the read() call to be interrupted. > Got a simple prgram to demonstrate the problem? No, but I will attempt to create one. Larry Ching Cisco Systems lching@cisco.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message