Date: Mon, 11 Nov 1996 05:44:19 -0500 (EST) From: "Marc G. Fournier" <scrappy@ki.net> To: Tim Pierce <twpierce@bio-3.bsd.uchicago.edu> Cc: hackers@FreeBSD.ORG Subject: Re: semaphores/shared memory Message-ID: <Pine.NEB.3.95.961111054151.10127G-100000@quagmire.ki.net> In-Reply-To: <9611110338.AA13774@bio-5.bsd.uchicago.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.95.961111054151.10127G-100000>