From owner-freebsd-hackers Tue Feb 27 13: 4:42 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from hda.hda.com (host65.hda.com [63.104.68.65]) by hub.freebsd.org (Postfix) with ESMTP id 84BEA37B71D for ; Tue, 27 Feb 2001 13:04:36 -0800 (PST) (envelope-from dufault@hda.hda.com) Received: (from dufault@localhost) by hda.hda.com (8.11.1/8.11.1) id f1RL2Sr24485; Tue, 27 Feb 2001 16:02:28 -0500 (EST) (envelope-from dufault) From: Peter Dufault Message-Id: <200102272102.f1RL2Sr24485@hda.hda.com> Subject: Re: Where can I find out rules on blocking in threads? In-Reply-To: <200102272051.MAA42206@akira.lanfear.com> from Marc W at "Feb 27, 2001 12:51:11 pm" To: Marc W Date: Tue, 27 Feb 2001 16:02:28 -0500 (EST) Cc: freebsd-hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL61 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I have tried this, but it gets even weirder then: > > - the call to open always succeeds right away (even when there are > no threads on the write end of the fifo) > - the immediately following call to read() also succeeds, returning > 0 bytes as the number of bytes read. > > > it gets worse -- when i change my loop to be: > > while (1) { > > fifo = open(fifoPath, O_RDONLY | O_NONBLOCK); > cread = read(fifo, buf, sizeof(buf)); > if (cread > 0) do_something(); > close(fifo); > usleep(100000); > } > > anybody who tries to open the write end of the fifo ends up hanging Set the FIFO blocking with fcntl(2) after you open it. I'll hack up my test program to be sure that works. Peter -- Peter Dufault (dufault@hda.com) Realtime development, Machine control, HD Associates, Inc. Fail-Safe systems, Agency approval To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message