From owner-freebsd-hackers Sun Jan 31 21:52:56 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA25831 for freebsd-hackers-outgoing; Sun, 31 Jan 1999 21:52:56 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from gateway.osi.ru (gateway.osi.ru [195.178.194.6]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA25823 for ; Sun, 31 Jan 1999 21:52:47 -0800 (PST) (envelope-from ks@osi.ru) Received: from speecart.osi.ru (speecart.osi.ru [195.178.194.35]) by gateway.osi.ru (8.9.1/8.9.1) with ESMTP id IAA10752; Mon, 1 Feb 1999 08:54:44 +0300 (MSK) Message-ID: X-Mailer: XFMail 1.2 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <199901302346.QAA24966@usr04.primenet.com> Date: Mon, 01 Feb 1999 08:59:48 +0300 (MSK) Organization: OSI AF, Moscow office From: "Sergey S. Kosyakov" To: Terry Lambert Subject: Re: select and threads again Cc: freebsd-hackers@FreeBSD.ORG Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Thank you for detailed information. There was no write selecting at all (I guess), but was exceptional conditions selecting. The socketpair() fails in the same manner. I will try AF_INET socket later, because it is needed to make much more changes in ILU code. Sergey On 30-Jan-99 Terry Lambert wrote: > > The real non-libc_r wrapped select is supposed to be called by the > wrapping select using a zero valued timeval struct (effecting a "poll") > when there are other threads ready to run. > > When all threads are blocked pending I/O on fd's, then a real select is > called on all of the fd's on which I/O is pending with a NULL pointer > instead of a zero valued timeval struct. This makes the select hang > until I/O is available on one or more of the fd's. > > If you are getting a blocking select, then the only possible cause > is that the scheduler believes that there are no other threads in > a read-to-run state, and therefore makes the blocking call instead > of call converting it to a polling call which, if not input is > pending, is followed by a threads context switch. > > > Perhaps you are both read and write selecting the pipe fd, in two > seperate threads? > > In general, write selecting is a bad idea. > > This may be a problem in the pipe code, or in the wrapping function > in libc_r (unlikely). > > You could try using a POSIX domain socket instead of a pipe; it uses > the same underlying code (man socketpair). If this also hangs, try > using a real socket (AF_INET instead of AF_UNIX). > > Also, make sure you are not using fork(), since it interacts badly > with threads. > > > Terry Lambert > terry@lambert.org > --- > Any opinions in this posting are my own and not those of my present > or previous employers. --- ---------------------------------- E-Mail: Sergey S. Kosyakov Date: 01-Feb-99 Time: 08:44:42 ---------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message