From owner-freebsd-stable Fri Sep 29 1:53: 6 2000 Delivered-To: freebsd-stable@freebsd.org Received: from moon.harmonic.co.il (moon.harmonic.co.il [192.116.140.65]) by hub.freebsd.org (Postfix) with ESMTP id E66CA37B423 for ; Fri, 29 Sep 2000 01:52:53 -0700 (PDT) Received: (from nobody@localhost) by moon.harmonic.co.il (8.9.3/8.9.3) id KAA29863; Fri, 29 Sep 2000 10:52:00 +0200 To: Alfred Perlstein Subject: Re: pthreads bug? Message-ID: <970217520.39d4583032fbe@webmail.harmonic.co.il> Date: Fri, 29 Sep 2000 10:52:00 +0200 (IST) From: Roman Shterenzon Cc: freebsd-stable@FreeBSD.ORG References: <970215688.39d451088fbef@webmail.harmonic.co.il> <20000929013521.C27736@fw.wintelcom.net> In-Reply-To: <20000929013521.C27736@fw.wintelcom.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: IMP/PHP IMAP webmail program 2.2.2 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Quoting Alfred Perlstein : > > I attach example program, which, when receives SIGUSR1 should close > the socket, > > but, in fact gets blocked in the close() function. > > Obviously it's waiting to acquire some lock. > > Does anyone have an idea? > > Yes, I have an idea and an idea how to fix it, I'm wondering what > the thread in accept() sees after this happens? > > what is the errno from accept? The point is, that when close() is called, accept doesn't break out. from close(2) IMPLEMENTATION NOTES In the non-threaded library close() is implemented as the close syscall. In the threaded library, the close syscall is assembled to _thread_sys_close() and close() is implemented as a function which locks d for read and write, then calls _thread_sys_close(). Before returning, close() unlocks d. So from my point of view the close tries to acquire a lock. --Roman Shterenzon, UNIX System Administrator and Consultant [ Xpert UNIX Systems Ltd., Herzlia, Israel. Tel: +972-9-9522361 ] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message