From owner-freebsd-hackers Fri Dec 18 15:09:27 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id PAA16429 for freebsd-hackers-outgoing; Fri, 18 Dec 1998 15:09:27 -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 PAA16424 for ; Fri, 18 Dec 1998 15:09:25 -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 SAA25004; Fri, 18 Dec 1998 18:09:15 -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 SAA02965; Fri, 18 Dec 1998 18:09:34 -0500 (EST) (envelope-from lching@cisco.com) Message-ID: <367AE0AE.4820BC12@cisco.com> Date: Fri, 18 Dec 1998 18:09:34 -0500 From: Larry Ching X-Mailer: Mozilla 4.04 [en] (X11; I; FreeBSD 2.2.6-RELEASE i386) MIME-Version: 1.0 To: hackers@FreeBSD.ORG CC: lching@cisco.com Subject: pthreads question Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Greetings. I am having a problem porting an application that runs on FreeBSD 2.2.6 and doesn't on FreeBSD 3.0. The problem seems to be caused by differences in the pthreads implemention on the two systems. Trying to state the problem in its simplest terms, the application spawns a thread that continually tries to read data from a device. The thread, of course, blocks on the read() call if no data is available from the device. To terminate the read thread, another thread issues a pthread_kill() call to the read thread, which in 2.2.6 would cause the read() to return -1 with an errno of EINTR. This would cause the thread to terminate itself. However, under 3.0 the read does not return and the reader thread remains blocked. I have scanned through the pthread code under 3.0 and the difference seems to lie in the pthread_kill() code in uthread_kill.c. Specifically, the signal specified in pthread_kill() is just added to the signal list if the thread is in any other state except PS_SIGSUSPEND or PS_SIGWAIT. I believe that the reader thread is in PS_FDR_WAIT state at this point and thus nothing happens. What is the expected behaviour here? Is there a better way to do this? Thanks for any and all help. Larry Ching Cisco Systems To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message