From owner-freebsd-hackers Tue May 21 15:16:02 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id PAA03925 for hackers-outgoing; Tue, 21 May 1996 15:16:02 -0700 (PDT) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id PAA03898 for ; Tue, 21 May 1996 15:16:00 -0700 (PDT) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id PAA02223; Tue, 21 May 1996 15:10:08 -0700 From: Terry Lambert Message-Id: <199605212210.PAA02223@phaeton.artisoft.com> Subject: Re: Socket library question To: stevenf@thetics.europa.com (Steven Frank) Date: Tue, 21 May 1996 15:10:08 -0700 (MST) Cc: freebsd-hackers@FreeBSD.org In-Reply-To: from "Steven Frank" at May 21, 96 11:10:10 am X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk > I have ported the BSD socket library to another OS, and added an > integrated PPP interface and modem dialer. The ultimate goal is a > Trumpet WinSock-ish type of application. Which OS? > It all seems to be working well except for one thing. When a client > application calls recv(), and the recv() cannot be fulfilled immediately, > the kernel calls sbwait() which in turn calls tsleep(). Somehow the > appropriate wakeup is not happening and it stays in tsleep() > indefinitely. If this is Win95 we're talking about here, then you probably implemented these with the Win95 semaphore calls? You should be aware of two things: 1) When an event to be processed comes in, it can be run on any blocking thread. 2) The semaphores are not good for blocking self reeentrancy. Effectively, this means Win95 can reentry your code with any async event and you are powerless to stop it, unless you implement a counting semaphore on top of their thread semaphores. This became obvious when running updated in UFS implemented on Windows95; I can't claim credit for the kill. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.