From owner-freebsd-hackers Mon Nov 11 02:44:21 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id CAA07247 for hackers-outgoing; Mon, 11 Nov 1996 02:44:21 -0800 (PST) Received: from quagmire.ki.net (root@quagmire.ki.net [205.150.102.1]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id CAA07242 for ; Mon, 11 Nov 1996 02:44:18 -0800 (PST) Received: from localhost (scrappy@localhost) by quagmire.ki.net (8.8.2/8.7.5) with SMTP id FAA12226; Mon, 11 Nov 1996 05:44:23 -0500 (EST) Date: Mon, 11 Nov 1996 05:44:19 -0500 (EST) From: "Marc G. Fournier" To: Tim Pierce cc: hackers@FreeBSD.ORG Subject: Re: semaphores/shared memory In-Reply-To: <9611110338.AA13774@bio-5.bsd.uchicago.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Sun, 10 Nov 1996, Tim Pierce wrote: > I wrote: > > > > essentially, I want the server to write a line of data to > > > shared memory, then signal all the clients at once that the data is > > > there, so that they all pick up the data... > > > > It sounds like this ought to be easy if you simply have each > > client wait on the semaphore, and then have the server increment > > the semaphore by a suitably high number (e.g. MAXINT) in order to > > ensure that they all are freed at once. > > No, sorry, even this shouldn't be necessary. Have the server > create the semaphore and increment its value to 1. Then have each > client wait until the semaphore becomes 0. When the data has been > written to shared memory, have the server decrement the semaphore > to zero, which will unblock all of the clients. > Okay, now bearing in mind that I'm looking at the examples as presented in "Unix Network Programming" by W. Richard Stevens...how do n clients signal back to the server that its finished with the data and can send up the next set of data? Marc G. Fournier scrappy@ki.net Systems Administrator @ ki.net scrappy@freebsd.org